Colored pretty-print of perl data structures and objects
Want to see what's inside a variable in a complete, colored and human-friendly way?
use Data::Printer; # or just "use DDP" for short p @array; # no need to pass references
Code above might output something like this (with colors!):
[ [0] "a", [1] "b", [2] undef, [3] "c", ]
You can also inspect objects:
my $obj = SomeClass->new;
p($obj);
Which might give you something like:
\ SomeClass { Parents Moose::Object Linear @ISA SomeClass, Moose::Object public methods (3) : bar, foo, meta private methods (0) internals: { _something => 42, } }
Data::Printer is fully customizable. If you want to change how things are displayed, or even its standard behavior. Take a look at the available customizations. Once you figure out your own preferences, create a configuration file for yourself and Data::Printer will automatically use it!
That's about it! Feel free to stop reading now and start dumping your data structures! For more information, including feature set, how to create filters, and general tips, just keep reading :)
Oh, if you are just experimenting and/or don't want to use a configuration file, you can set all options during initialization, including coloring, identation and filters!
use Data::Printer { color => { 'regex' => 'blue', 'hash' => 'yellow', }, filters => { 'DateTime' => sub { $_[0]->ymd }, 'SCALAR' => sub { "oh noes, I found a scalar! $_[0]" }, }, };
The first \*(C`{}\*(C' block is just syntax sugar, you can safely ommit it if it makes things easier to read:
use DDP colored => 1;
use Data::Printer deparse => 1, sort_keys => 0;
Here's what Data::Printer has to offer to Perl developers, out of the box:
Very sane defaults (I hope!)
Highly customizable (in case you disagree with me :)
Colored output by default
Human-friendly output, with array index and custom separators
Full object dumps including methods, inheritance and internals
Exposes extra information such as tainted data and weak references
Ability to easily create filters for objects and regular structures
Ability to load settings from a \*(C`.dataprinter\*(C' file so you don't have to write anything other than \*(L"use \s-1DDP\s0;\*(R" in your code!
Data::Dumper is a fantastic tool, meant to stringify data structures in a way they are suitable for being \*(C`eval\*(C''ed back in.
The thing is, a lot of people keep using it (and similar ones, like Data::Dump) to print data structures and objects on screen for inspection and debugging, and while you can use those modules for that, it doesn't mean mean you should.
This is where Data::Printer comes in. It is meant to do one thing and one thing only:
display Perl variables and objects on screen, properly formatted (to be inspected by a human)
If you want to serialize/store/restore Perl data structures, this module will \s-1NOT\s0 help you. Try Storable, Data::Dumper, \s-1JSON\s0, or whatever. \s-1CPAN\s0 is full of such solutions!
Once you load Data::Printer, the \*(C`p()\*(C' function will be imported into your namespace and available to you. It will pretty-print into \s-1STDERR\s0 (or any other output target) whatever variabe you pass to it.
By default, \*(C`p()\*(C' will be set to use \s-1STDERR\s0. As of version 0.27, you can set up the 'output' property so Data::Printer outputs to several different places:
\*(C`output => 'stderr'\*(C' - Standard error. Same as *STDERR
\*(C`output => 'stdout'\*(C' - Standard output. Same as *STDOUT
\*(C`output => $filename\*(C' - Appends to filename.
\*(C`output => $file_handle\*(C' - Appends to opened handle
\*(C`output => \$scalar\*(C' - Appends to that variable's content
If for whatever reason you want to mangle with the output string instead of printing it, you can simply ask for a return value:
# move to a string my $string = p @some_array;
# output to STDOUT instead of STDERR; print p(%some_hash);
Note that, in this case, Data::Printer will not colorize the returned string unless you explicitly set the \*(C`colored\*(C' option to 1:
print p(%some_hash, colored => 1); # now with colors!
You can - and should - of course, set this during you "\*(C`use\*(C'" call:
use Data::Printer colored => 1; print p( %some_hash ); # will be colored
Or by adding the setting to your \*(C`.dataprinter\*(C' file.
As most of Data::Printer, the return value is also configurable. You do this by setting the \*(C`return_value\*(C' option. There are three options available:
'dump' (default): p %var; # prints the dump to STDERR (void context) my $string = p %var; # returns the dump *without* printing
'void': p %var; # prints the dump to STDERR, never returns. my $string = p %var; # $string is undef. Data still printed in STDERR
'pass': p %var; # prints the dump to STDERR, returns %var my %copy = p %var; # %copy = %var. Data still printed in STDERR
Below are all the available colorizations and their default values. Note that both spellings ('color' and 'colour') will work.
use Data::Printer { color => { array => 'bright_white', # array index numbers number => 'bright_blue', # numbers string => 'bright_yellow', # strings class => 'bright_green', # class names method => 'bright_green', # method names undef => 'bright_red', # the 'undef' value hash => 'magenta', # hash keys regex => 'yellow', # regular expressions code => 'green', # code references glob => 'bright_cyan', # globs (usually file handles) vstring => 'bright_blue', # version strings (v5.16.0, etc) repeated => 'white on_red', # references to seen values caller_info => 'bright_cyan', # details on what's being printed weak => 'cyan', # weak references tainted => 'red', # tainted content escaped => 'bright_red', # escaped characters (\t, \n, etc)
# potential new Perl datatypes, unknown to Data::Printer unknown => 'bright_yellow on_blue', }, };
Don't fancy colors? Disable them with:
use Data::Printer colored => 0;
By default, 'colored' is set to "auto", which means Data::Printer will colorize only when not being used to return the dump string, nor when the output (default: \s-1STDERR\s0) is being piped. If you're not seeing colors, try forcing it with:
use Data::Printer colored => 1;
Also worth noticing that Data::Printer will honor the \*(C`ANSI_COLORS_DISABLED\*(C' environment variable unless you force a colored output by setting 'colored' to 1.
Remember to put your preferred settings in the \*(C`.dataprinter\*(C' file so you never have to type them at all!
Data::Printer provides the nice, short, \*(C`p()\*(C' function to dump your data structures and objects. In case you rather use a more explicit name, already have a \*(C`p()\*(C' function (why?) in your code and want to avoid clashing, or are just used to other function names for that purpose, you can easily rename it:
use Data::Printer alias => 'Dumper';
Dumper( %foo );
I tried to provide sane defaults for Data::Printer, so you'll never have to worry about anything other than typing "p( $var )" in your code. That said, and besides coloring and filtering, there are several other customization options available, as shown below (with default values):
use Data::Printer { name => 'var', # name to display on cyclic references indent => 4, # how many spaces in each indent hash_separator => ' ', # what separates keys from values colored => 'auto', # colorize output (1 for always, 0 for never) index => 1, # display array indices multiline => 1, # display in multiple lines (see note below) max_depth => 0, # how deep to traverse the data (0 for all) sort_keys => 1, # sort hash keys deparse => 0, # use B::Deparse to expand (expose) subroutines show_tied => 1, # expose tied variables show_tainted => 1, # expose tainted variables show_weak => 1, # expose weak references show_readonly => 0, # expose scalar variables marked as read-only show_lvalue => 1, # expose lvalue types print_escapes => 0, # print non-printable chars as "\n", "\t", etc. quote_keys => 'auto', # quote hash keys (1 for always, 0 for never). # 'auto' will quote when key is empty/space-only. separator => ',', # uses ',' to separate array/hash elements end_separator => 0, # prints the separator after last element in array/hash. # the default is 0 that means not to print
caller_info => 0, # include information on what's being printed use_prototypes => 1, # allow p(%foo), but prevent anonymous data return_value => 'dump', # what should p() return? See 'Return Value' above. output => 'stderr',# where to print the output. See # 'Changing output targets' above.
class_method => '_data_printer', # make classes aware of Data::Printer # and able to dump themselves.
class => { internals => 1, # show internal data structures of classes
inherited => 'none', # show inherited methods, # can also be 'all', 'private', or 'public'.
universal => 1, # include UNIVERSAL methods in inheritance list
parents => 1, # show parents, if there are any linear_isa => 'auto', # show the entire @ISA, linearized, whenever # the object has more than one parent. Can # also be set to 1 (always show) or 0 (never).
expand => 1, # how deep to traverse the object (in case # it contains other objects). Defaults to # 1, meaning expand only itself. Can be any # number, 0 for no class expansion, and 'all' # to expand everything.
sort_methods => 1, # sort public and private methods
show_methods => 'all' # method list. Also 'none', 'public', 'private' }, };
Note: setting \*(C`multiline\*(C' to 0 will also set \*(C`index\*(C' and \*(C`indent\*(C' to 0.
Data::Printer offers you the ability to use filters to override any kind of data display. The filters are placed on a hash, where keys are the types - or class names - and values are anonymous subs that receive two arguments: the item itself as first parameter, and the properties hashref (in case your filter wants to read from it). This lets you quickly override the way Data::Printer handles and displays data types and, in particular, objects.
use Data::Printer filters => { 'DateTime' => sub { $_[0]->ymd }, 'HTTP::Request' => sub { $_[0]->uri }, };
Perl types are named as \*(C`ref\*(C' calls them: \s-1SCALAR\s0, \s-1ARRAY\s0, \s-1HASH\s0, \s-1REF\s0, \s-1CODE\s0, Regexp and \s-1GLOB\s0. As for objects, just use the class' name, as shown above.
As of version 0.13, you may also use the '-class' filter, which will be called for all non-perl types (objects).
Your filters are supposed to return a defined value (usually, the string you want to print). If you don't, Data::Printer will let the next filter of that same type have a go, or just fallback to the defaults. You can also use an array reference to pass more than one filter for the same type or class.
Note: If you plan on calling \*(C`p()\*(C' from within an inline filter, please make sure you are passing only \s-1REFERENCES\s0 as arguments. See \*(L"\s-1CAVEATS\s0\*(R" below.
You may also like to specify standalone filter modules. Please see Data::Printer::Filter for further information on a more powerful filter interface for Data::Printer, including useful filters that are shipped as part of this distribution.
Whenever printing the contents of a class, Data::Printer first checks to see if that class implements a sub called '_data_printer' (or whatever you set the \*(L"class_method\*(R" option to in your settings, see \*(L"\s-1CUSTOMIZATION\s0\*(R" below).
If a sub with that exact name is available in the target object, Data::Printer will use it to get the string to print instead of making a regular class dump.
This means you could have the following in one of your classes:
sub _data_printer { my ($self, $properties) = @_; return 'Hey, no peeking! But foo contains ' . $self->foo; }
Notice you don't have to depend on Data::Printer at all, just write your sub and it will use that to pretty-print your objects.
If you want to use colors and filter helpers, and still not add Data::Printer to your dependencies, remember you can import them during runtime:
sub _data_printer { require Data::Printer::Filter; Data::Printer::Filter->import;
# now we have 'indent', outdent', 'linebreak', 'p' and 'colored' my ($self, $properties) = @_; ... }
Having a filter for that particular class will of course override this setting.
Data::Printer tries to let you easily customize as much as possible regarding the visualization of your data structures and objects. But we don't want you to keep repeating yourself every time you want to use it!
To avoid this, you can simply create a file called \*(C`.dataprinter\*(C' in your home directory (usually \*(C`/home/username\*(C' in Linux), and put your configuration hash reference in there.
This way, instead of doing something like:
use Data::Printer { colour => { array => 'bright_blue', }, filters => { 'Catalyst::Request' => sub { my $req = shift; return "Cookies: " . p($req->cookies) }, }, };
You can create a .dataprinter file that looks like this:
{ colour => { array => 'bright_blue', }, filters => { 'Catalyst::Request' => sub { my $req = shift; return "Cookies: " . p($req->cookies) }, }, };
Note that all we did was remove the \*(L"use Data::Printer\*(R" bit when writing the \*(C`.dataprinter\*(C' file. From then on all you have to do while debugging scripts is:
use Data::Printer;
and it will load your custom settings every time :)
If your \s-1RC\s0 file is somewhere other than \*(C`.dataprinter\*(C' in your home dir, you can load whichever file you want via the 'rc_file' parameter:
use Data::Printer rc_file => '/path/to/my/rcfile.conf';
You can even set this to undef or to a non-existing file to disable your \s-1RC\s0 file at will.
The \s-1RC\s0 file location can also be specified with the \*(C`DATAPRINTERRC\*(C' environment variable. Using \*(C`rc_file\*(C' in code will override the environment variable.
The \*(C`.dataprinter\*(C' \s-1RC\s0 file is nothing but a Perl hash that gets \*(C`eval\*(C''d back into the code. This means that whatever is in your \s-1RC\s0 file \s-1WILL\s0 \s-1BE\s0 \s-1INTERPRETED\s0 \s-1BY\s0 \s-1PERL\s0 \s-1AT\s0 \s-1RUNTIME\s0. This can be quite worrying if you're not the one in control of the \s-1RC\s0 file.
For this reason, Data::Printer takes extra precaution before loading the file:
The file has to be in your home directory unless you specifically point elsewhere via the '\*(C`rc_file\*(C'' property or the \s-1DATAPRINTERRC\s0 environment variable;
The file must be a plain file, never a symbolic link, named pipe or socket;
The file must be owned by you (i.e. the effective user id that ran the script using Data::Printer);
The file must be read-only for everyone but your user. This usually means permissions 0644, 0640 or 0600 in Unix-like systems. \s-1THIS\s0 \s-1IS\s0 \s-1NOT\s0 \s-1CHECKED\s0 \s-1IN\s0 \s-1WIN32\s0;
The file will \s-1NOT\s0 be loaded in Taint mode, unless you specifically load Data::Printer with the 'allow_tainted' option set to true. And even if you do that, Data::Printer will still issue a warning before loading the file. But seriously, don't do that.
Failure to comply with the security rules above will result in the \s-1RC\s0 file not being loaded (likely with a warning on what went wrong). You're likely to add/remove Data::Printer from source code being developed and debugged all the time, and typing it might feel too long. Because of this, the '\s-1DDP\s0' package is provided as a shorter alias to Data::Printer:
use DDP; p %some_var;
If you set caller_info to a true value, Data::Printer will prepend every call with an informational message. For example:
use Data::Printer caller_info => 1;
my $var = 42; p $var;
will output something like:
Printing in line 4 of myapp.pl: 42
The default message is 'Printing in line _\|_LINE_\|_ of _\|_FILENAME_\|_:'. The special strings \*(C`_\|_LINE_\|_\*(C', \*(C`_\|_FILENAME_\|_\*(C' and \*(C`_\|_PACKAGE_\|_\*(C' will be interpolated into their according value so you can customize them at will:
use Data::Printer caller_info => 1, caller_message => "Okay, _\|_PACKAGE_\|_, let's dance!" color => { caller_info => 'bright_red', };
As shown above, you may also set a color for \*(L"caller_info\*(R" in your color hash. Default is cyan.
The following are volatile parts of the \s-1API\s0 which are subject to change at any given version. Use them at your own risk.
You can override global configurations by writing them as the second parameter for p(). For example:
p( %var, color => { hash => 'green' } );
As of Data::Printer 0.11, you can create complex filters as a separate module. Those can even be uploaded to \s-1CPAN\s0 and used by other people! See Data::Printer::Filter for further information.
You can't pass more than one variable at a time.
p($foo, $bar); # wrong p($foo); # right p($bar); # right
The default mode is to use prototypes, in which you are supposed to pass variables, not anonymous structures:
p( { foo => 'bar' } ); # wrong
p %somehash; # right p $hash_ref; # also right
To pass anonymous structures, set \*(L"use_prototypes\*(R" option to 0. But remember you'll have to pass your variables as references:
use Data::Printer use_prototypes => 0;
p( { foo => 'bar' } ); # was wrong, now is right.
p( %foo ); # was right, but fails without prototypes p( \%foo ); # do this instead
If you are using inline filters, and calling p() (or whatever name you aliased it to) from inside those filters, you must pass the arguments to \*(C`p()\*(C' as a reference:
use Data::Printer { filters => { ARRAY => sub { my $listref = shift; my $string = ''; foreach my $item (@$listref) { $string .= p( \$item ); # p( $item ) will not work! } return $string; }, }, };
This happens because your filter function is compiled before Data::Printer itself loads, so the filter does not see the function prototype. As a way to avoid unpleasant surprises, if you forget to pass a reference, Data::Printer will generate an exception for you with the following message:
'When calling p() without prototypes, please pass arguments as references'
Another way to avoid this is to use the much more complete Data::Printer::Filter interface for standalone filters.
The \*(C`p()\*(C' function uses prototypes by default, allowing you to say:
p %var;
instead of always having to pass references, like:
p \%var;
There are cases, however, where you may want to pass anonymous structures, like:
p { foo => $bar }; # this blows up, don't use
and because of prototypes, you can't. If this is your case, just set \*(L"use_prototypes\*(R" option to 0. Note, with this option, you will have to pass your variables as references:
use Data::Printer use_prototypes => 0;
p { foo => 'bar' }; # doesn't blow up anymore, works just fine.
p %var; # but now this blows up... p \%var; # ...so do this instead
p [ $foo, $bar, \@baz ]; # this way you can even pass # several variables at once
Versions prior to 0.17 don't have the \*(L"use_prototypes\*(R" option. If you're stuck in an older version you can write \*(C`&p()\*(C' instead of \*(C`p()\*(C' to circumvent prototypes and pass elements (including anonymous variables) as \s-1REFERENCES\s0. This notation, however, requires enclosing parentheses:
&p( { foo => $bar } ); # this is ok, use at will &p( \"DEBUGGING THIS BIT" ); # this works too
Or you could just create a very simple wrapper function:
sub pp { p @_ };
And use it just as you use \*(C`p()\*(C'.
(contributed by Matt S. Trout (mst))
There is a reason why explicit return statements are recommended unless you know what you're doing. By default, Data::Printer's return value depends on how it was called. When not in void context, it returns the serialized form of the dump.
It's tempting to trust your own p() calls with that approach, but if this is your last statement in a function, you should keep in mind your debugging code will behave differently depending on how your function was called!
To prevent that, set the \*(C`return_value\*(C' property to either 'void' or 'pass'. You won't be able to retrieve the dumped string but, hey, who does that anyway :)
Assuming you have set the pass-through ('pass') property in your \*(C`.dataprinter\*(C' file, another stunningly useful thing you can do with it is change code that says:
return $obj->foo;
with:
use DDP;
return p $obj->foo;
You can even add it to chained calls if you wish to see the dump of a particular state, changing this:
$obj->foo->bar->baz;
to:
$obj->foo->DDP::p->bar->baz
And things will \*(L"Just Work\*(R".
(contributed by Matt S. Trout (mst))
While debugging your software, you may want to use Data::Printer in some or all loaded modules and not bother having to load it in each and every one of them. To do this, in any module loaded by \*(C`myapp.pl\*(C', simply write:
::p( @myvar ); # note the '::' in front of p()
Then call your program like:
perl -MDDP myapp.pl
This also has the great advantage that if you leave one p() call in by accident, it will fail without the -M, making it easier to spot :)
If you really want to have p() imported into your loaded modules, use the next tip instead.
(contributed by A\*'rpa\*'d Sza\*'sz)
If you wish to automatically add Data::Printer's \*(C`p()\*(C' function to every loaded module in you app, you can do something like this to your main program:
BEGIN { { no strict 'refs'; require Data::Printer; my $alias = 'p'; foreach my $package ( keys %main:: ) { if ( $package =~ m/::$/ ) { *{ $package . $alias } = \&Data::Printer::p; } } } }
\s-1WARNING\s0 This will override all locally defined subroutines/methods that are named \*(C`p\*(C', if they exist, in every loaded module. If you already have a subroutine named '\*(C`p()\*(C'', be sure to change $alias to something custom.
If you rather avoid namespace manipulation altogether, use the previous tip instead.
(contributed by A\*'rpa\*'d Sza\*'sz and Marcel Gru\*:nauer (hanekomu))
With DB::Pluggable, you can easily set the perl debugger to use Data::Printer to print variable information, replacing the debugger's standard \*(C`p()\*(C' function. All you have to do is add these lines to your \*(C`.perldb\*(C' file:
use DB::Pluggable; DB::Pluggable->run_with_config( \'[DataPrinter]' ); # note the '\'
Then call the perl debugger as you normally would:
perl -d myapp.pl
Now Data::Printer's \*(C`p()\*(C' command will be used instead of the debugger's!
See perldebug for more information on how to use the perl debugger, and DB::Pluggable for extra functionality and other plugins.
If you can't or don't wish to use DB::Pluggable, or simply want to keep the debugger's \*(C`p()\*(C' function and add an extended version using Data::Printer (let's call it \*(C`px()\*(C' for instance), you can add these lines to your \*(C`.perldb\*(C' file instead:
$DB::alias{px} = 's/px/DB::px/'; sub px { my $expr = shift; require Data::Printer; print Data::Printer::p($expr); }
Now, inside the Perl debugger, you can pass as reference to \*(C`px\*(C' expressions to be dumped using Data::Printer.
Some people really enjoy using a \s-1REPL\s0 shell to quickly try Perl code. One of the most famous ones out there is Devel::REPL. If you use it, now you can also see its output with Data::Printer!
Just install Devel::REPL::Plugin::DataPrinter and add the following line to your re.pl configuration file (usually \*(L".re.pl/repl.rc\*(R" in your home dir):
load_plugin('DataPrinter');
The next time you run \*(C`re.pl\*(C', it should dump all your \s-1REPL\s0 using Data::Printer!
To turn Data::Printer's output into \s-1HTML\s0, you can do something like:
use HTML::FromANSI; use Data::Printer;
my $html_output = ansi2html( p($object, colored => 1) );
In the example above, the $html_output variable contains the \s-1HTML\s0 escaped output of \*(C`p($object)\*(C', so you can print it for later inspection or render it (if it's a web app).
(contributed by Stephen Thirlwall (sdt))
If you use Template Toolkit and want to dump your variables using Data::Printer, install the Template::Plugin::DataPrinter module and load it in your template:
[% USE DataPrinter %]
The provided methods match those of \*(C`Template::Plugin::Dumper\*(C':
ansi-colored dump of the data structure in "myvar": [% DataPrinter.dump( myvar ) %]
html-formatted, colored dump of the same data structure: [% DataPrinter.dump_html( myvar ) %]
The module allows several customization options, even letting you load it as a complete drop-in replacement for Template::Plugin::Dumper so you don't even have to change your previous templates!
(contributed by Kevin McGrath (catlgrep))
If you are porting your code to use Data::Printer instead of Data::Dumper or similar, you can just replace:
use Data::Dumper;
with:
use Data::Printer alias => 'Dumper'; # use Data::Dumper;
making sure to provide Data::Printer with the proper alias for the previous dumping function.
If, however, you want a really unified approach where you can easily flip between debugging outputs, use Any::Renderer and its plugins, like Any::Renderer::Data::Printer.
(contributed by Sergey Aleynikov (randir))
There are times where viewing the current state of a variable is not enough, and you want/need to see a full stack trace of a function call.
The Devel::PrettyTrace module uses Data::Printer to provide you just that. It exports a \*(C`bt()\*(C' function that pretty-prints detailed information on each function in your stack, making it easier to spot any issues!
(contributed by Marcel Gru\*:nauer (hanekomu))
dip is a dynamic instrumentation framework for troubleshooting Perl programs, similar to DTrace <http://opensolaris.org/os/community/dtrace/>. In a nutshell, \*(C`dip\*(C' lets you create probes for certain conditions in your application that, once met, will perform a specific action. Since it uses Aspect-oriented programming, it's very lightweight and you only pay for what you use.
\*(C`dip\*(C' can be very useful since it allows you to debug your software without changing a single line of your original code. And Data::Printer comes bundled with it, so you can use the \*(C`p()\*(C' function to view your data structures too!
# Print a stack trace every time the name is changed, # except when reading from the database. dip -e 'before { print longmess(p $_->{args}[1]) if $_->{args}[1] } call "MyObj::name" & !cflow("MyObj::read")' myapp.pl
You can check you dip's own documentation for more information and options.
(contributed by Yanick Champoux (yanick))
The \*(L"examples/try_me.pl\*(R" file included in this distribution has a sample dump with a complex data structure to let you quickly test color schemes.
(contributed by dirk)
Sometimes, you may want to take advantage of Data::Printer's original dump, but add/change some of the original data to enhance your debugging ability. Say, for example, you have an \*(C`HTTP::Response\*(C' object you want to print but the content is encoded. The basic approach, of course, would be to just dump the decoded content:
use DDP filter { 'HTTP::Response' => sub { p( \shift->decoded_content, %{shift} ); };
But what if you want to see the rest of the original object? Dumping it would be a no-go, because you would just recurse forever in your own filter.
Never fear! When you create a filter in Data::Printer, you're not replacing the original one, you're just stacking yours on top of it. To forward your data to the original filter, all you have to do is return an undefined value. This means you can rewrite your \*(C`HTTP::Response\*(C' filter like so, if you want:
use DDP filters => { 'HTTP::Response' => sub { my ($res, $p) = @_;
# been here before? Switch to original handler return if exists $res->{decoded_content};
# first timer? Come on in! my $clone = $res->clone; $clone->{decoded_content} = $clone->decoded_content; return p($clone, %$p); } };
And voila\*`! Your fiddling filter now works like a charm :)
If you find any, please file a bug report.
Data::Dumper
Data::Dump
Data::Dumper::Concise
Data::Dump::Streamer
Data::PrettyPrintObjects
Data::TreeDumper
Breno G. de Oliveira \*(C`<garu at cpan.org>\*(C'
Many thanks to everyone that helped design and develop this module with patches, bug reports, wishlists, comments and tests. They are (alphabetically):
Allan Whiteford
Andreas Ko\*:nig
Andy Bach
A\*'rpa\*'d Sza\*'sz
brian d foy
Chris Prather (perigrin)
David Golden (xdg)
David Raab
Damien Krotkine (dams)
Denis Howe
Dotan Dimet
Eden Cardim (edenc)
Elliot Shank (elliotjs)
Fernando Corre\*^a (SmokeMachine)
Fitz Elliott
Ivan Bessarabov (bessarabv)
J Mash
Jesse Luehrs (doy)
Joel Berger (jberger)
Kartik Thakore (kthakore)
Kevin Dawson (bowtie)
Kevin McGrath (catlgrep)
Kip Hampton (ubu)
Marcel Gru\*:nauer (hanekomu)
Matt S. Trout (mst)
Maxim Vuets
Mike Doherty (doherty)
Paul Evans (LeoNerd)
PrzemysXaw WesoXek (jest)
Rebecca Turner (iarna)
Rob Hoelz (hoelzro)
Sebastian Willing (Sewi)
Sergey Aleynikov (randir)
Stanislaw Pusep (syp)
Stephen Thirlwall (sdt)
sugyan
Tatsuhiko Miyagawa (miyagawa)
Tim Heaney (oylenshpeegul)
Torsten Raudssus (Getty)
Wesley Dal`Col (blabos)
Yanick Champoux (yanick)
If I missed your name, please drop me a line!
Copyright 2011 Breno G. de Oliveira \*(C`<garu at cpan.org>\*(C'. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
\s-1BECAUSE\s0 \s-1THIS\s0 \s-1SOFTWARE\s0 \s-1IS\s0 \s-1LICENSED\s0 \s-1FREE\s0 \s-1OF\s0 \s-1CHARGE\s0, \s-1THERE\s0 \s-1IS\s0 \s-1NO\s0 \s-1WARRANTY\s0 \s-1FOR\s0 \s-1THE\s0 \s-1SOFTWARE\s0, \s-1TO\s0 \s-1THE\s0 \s-1EXTENT\s0 \s-1PERMITTED\s0 \s-1BY\s0 \s-1APPLICABLE\s0 \s-1LAW\s0. \s-1EXCEPT\s0 \s-1WHEN\s0 \s-1OTHERWISE\s0 \s-1STATED\s0 \s-1IN\s0 \s-1WRITING\s0 \s-1THE\s0 \s-1COPYRIGHT\s0 \s-1HOLDERS\s0 \s-1AND/OR\s0 \s-1OTHER\s0 \s-1PARTIES\s0 \s-1PROVIDE\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1WITHOUT\s0 \s-1WARRANTY\s0 \s-1OF\s0 \s-1ANY\s0 \s-1KIND\s0, \s-1EITHER\s0 \s-1EXPRESSED\s0 \s-1OR\s0 \s-1IMPLIED\s0, \s-1INCLUDING\s0, \s-1BUT\s0 \s-1NOT\s0 \s-1LIMITED\s0 \s-1TO\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \s-1MERCHANTABILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. \s-1THE\s0 \s-1ENTIRE\s0 \s-1RISK\s0 \s-1AS\s0 \s-1TO\s0 \s-1THE\s0 \s-1QUALITY\s0 \s-1AND\s0 \s-1PERFORMANCE\s0 \s-1OF\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \s-1IS\s0 \s-1WITH\s0 \s-1YOU\s0. \s-1SHOULD\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \s-1PROVE\s0 \s-1DEFECTIVE\s0, \s-1YOU\s0 \s-1ASSUME\s0 \s-1THE\s0 \s-1COST\s0 \s-1OF\s0 \s-1ALL\s0 \s-1NECESSARY\s0 \s-1SERVICING\s0, \s-1REPAIR\s0, \s-1OR\s0 \s-1CORRECTION\s0.
\s-1IN\s0 \s-1NO\s0 \s-1EVENT\s0 \s-1UNLESS\s0 \s-1REQUIRED\s0 \s-1BY\s0 \s-1APPLICABLE\s0 \s-1LAW\s0 \s-1OR\s0 \s-1AGREED\s0 \s-1TO\s0 \s-1IN\s0 \s-1WRITING\s0 \s-1WILL\s0 \s-1ANY\s0 \s-1COPYRIGHT\s0 \s-1HOLDER\s0, \s-1OR\s0 \s-1ANY\s0 \s-1OTHER\s0 \s-1PARTY\s0 \s-1WHO\s0 \s-1MAY\s0 \s-1MODIFY\s0 \s-1AND/OR\s0 \s-1REDISTRIBUTE\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \s-1AS\s0 \s-1PERMITTED\s0 \s-1BY\s0 \s-1THE\s0 \s-1ABOVE\s0 \s-1LICENCE\s0, \s-1BE\s0 \s-1LIABLE\s0 \s-1TO\s0 \s-1YOU\s0 \s-1FOR\s0 \s-1DAMAGES\s0, \s-1INCLUDING\s0 \s-1ANY\s0 \s-1GENERAL\s0, \s-1SPECIAL\s0, \s-1INCIDENTAL\s0, \s-1OR\s0 \s-1CONSEQUENTIAL\s0 \s-1DAMAGES\s0 \s-1ARISING\s0 \s-1OUT\s0 \s-1OF\s0 \s-1THE\s0 \s-1USE\s0 \s-1OR\s0 \s-1INABILITY\s0 \s-1TO\s0 \s-1USE\s0 \s-1THE\s0 \s-1SOFTWARE\s0 (\s-1INCLUDING\s0 \s-1BUT\s0 \s-1NOT\s0 \s-1LIMITED\s0 \s-1TO\s0 \s-1LOSS\s0 \s-1OF\s0 \s-1DATA\s0 \s-1OR\s0 \s-1DATA\s0 \s-1BEING\s0 \s-1RENDERED\s0 \s-1INACCURATE\s0 \s-1OR\s0 \s-1LOSSES\s0 \s-1SUSTAINED\s0 \s-1BY\s0 \s-1YOU\s0 \s-1OR\s0 \s-1THIRD\s0 \s-1PARTIES\s0 \s-1OR\s0 A \s-1FAILURE\s0 \s-1OF\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \s-1TO\s0 \s-1OPERATE\s0 \s-1WITH\s0 \s-1ANY\s0 \s-1OTHER\s0 \s-1SOFTWARE\s0), \s-1EVEN\s0 \s-1IF\s0 \s-1SUCH\s0 \s-1HOLDER\s0 \s-1OR\s0 \s-1OTHER\s0 \s-1PARTY\s0 \s-1HAS\s0 \s-1BEEN\s0 \s-1ADVISED\s0 \s-1OF\s0 \s-1THE\s0 \s-1POSSIBILITY\s0 \s-1OF\s0 \s-1SUCH\s0 \s-1DAMAGES\s0.