Data::Printer

Colored pretty-print of Perl data structures and objects
Download

Data::Printer Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Breno G. de Oliveira
  • Publisher web site:
  • http://search.cpan.org/~garu/

Data::Printer Tags


Data::Printer Description

Colored pretty-print of Perl data structures and objects Data::Dumper is a Perl module meant to stringify data structures in a way they are suitable for being eval'ed back in.SYNOPSIS use Data::Printer; # or just "use DDP" for short my @array = qw(a b); $array = 'c'; p @array; # no need to pass references!Code above will show this (with colored output): "a", "b", undef, "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, } }If for some reason you want to mangle with the output string instead of printing it to STDERR, 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); # or even render as HTML use HTML::FromANSI; ansi2html( p($object) );Finally, you can set all options during initialization, including coloring, identation and filters! use Data::Printer { color => { 'regex' => 'blue', 'hash' => 'yellow', }, filters => { 'DateTime' => sub { $_->ymd }, 'SCALAR' => sub { "oh noes, I found a scalar! $_" }, }, };You can ommit the first {} block and just initialize it with a regular hash, if it makes things easier to read: use Data::Printer deparse => 1, sort_keys => 0;And if you like your setup better than the defaults, just put them in a '.dataprinter' file in your home dir and don't repeat yourself ever again. Requirements: · Perl


Data::Printer Related Software