-
-
08 Jan 2015 06:48:58 UTC
- Distribution: Poet
- Module version: 0.16
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (7)
- Testers (797 / 15 / 0)
- Kwalitee
Bus factor: 1- 85.71% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (74.45KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- CHI
- Capture::Tiny
- Class::Load
- Data::Rmap
- File::ShareDir
- File::ShareDir::Install
- File::Slurp
- File::Spec::Functions
- Guard
- JSON::XS
- Log::Any::Adapter
- Mason
- Mason::Plugin::Cache
- Mason::Plugin::HTMLFilters
- Mason::Plugin::RouterSimple
- MasonX::ProcessDir
- Method::Signatures::Simple
- Moose
- MooseX::App::Cmd
- MooseX::HasDefaults::RO
- MooseX::StrictConstructor
- Plack
- Plack::Middleware::Debug
- Plack::Middleware::Session
- Plack::Session::Store::Cache
- Try::Tiny
- URI
- URI::Escape
- YAML::XS
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Poet::Util::Debug - Debug utilities
SYNOPSIS
# In a script... use Poet::Script; # In a module... use Poet; # Automatically available in Mason components # then... # die with value dd $data; # print value to STDERR dp $data; # print value to logs/console.log dc $data; # return value prepped for HTML dh $data; # same as above with full stacktraces dds $data; dps $data; dcs $data; dhs $data;
DESCRIPTION
These debug utilities are automatically imported wherever
use Poet
oruse Poet::Script
appear, and in all components. Because let's face it, debugging is something you always want at your fingertips.However, for safety, the short named versions of these utilities are no-ops outside of development mode, in case debug statements accidentally leak into production (we've all done it). You have to use longer, less convenient names outside of development for them to work.
UTILITIES
Each of these utilities takes a single scalar value. The value is serialized with Data::Dumper and prefixed with a file name, line number, and pid. e.g.
dp { a => 5, b => 6 };
prints to STDERR
[dp at ./d.pl line 6.] [1436] { a => 5, b => 6 }
The variants suffixed with 's' additionally output a full stack trace.
- dd ($val), dds ($val)
-
Die with the serialized $val.
- dp ($val), dps ($val)
-
Print the serialized $val to STDERR. Useful in scripts.
- dc ($val), dcs ($val)
-
Append the serialized $val to "console.log" in the
logs
subdirectory of the environment. Useful as a quick alternative to full-bore logging. - dh ($val), dhs ($val)
-
Returns the serialized $val, surrounded by
<pre> </pre>
tags. Useful for embedding in Mason components, e.g.<% dh($data) %>
Live variants
Each of the functions above must be appended with "_live" in order to work in live mode. e.g.
# This is a no-op in live mode dp [$foo]; # but this will work dp_live [$foo];
SEE ALSO
AUTHOR
Jonathan Swartz <swartz@pobox.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Poet, copy and paste the appropriate command in to your terminal.
cpanm Poet
perl -MCPAN -e shell install Poet
For more information on module installation, please visit the detailed CPAN module installation guide.