Is there a less sophisticated alternative to Perl Data :: Dumper?

I'm trying to print some parsing trees, and Data::Dumper very much for this, for example, to print:

 { 'A' => { 'ID' => 'y' }, 'OP' => '=', 'B' => { 'NUM' => '5' } }, 

instead of saying:

 { 'A' => {'ID' => 'y'}, 'OP' => '=', 'B' => {'NUM' => '5'} }, 

and it is very difficult to read, since it takes a huge number of lines.

Is there any Perl library that does what Data::Dumper does except shorter ones, or do I need to write my own?

+2
source share
3 answers

Do you want Data::Dump :

History

The Data::Dump module has grown due to frustration with Sarathy's in most cases - excellent Data::Dumper . Key ideas and some code in conjunction with the Sarathy module. The Data::Dump module provides a much simpler interface than Data::Dumper .

Data::Printer is a more modern alternative with color output.

+11
source

You mean besides Data :: Dumper :: Concise ? :)

+4
source

If using $Data::Dumper::Indent not enough, you might like to use the JSON or YAML module families if you only need human data (e.g. for debugging). Their format is close enough to Perl to read easily, and they have many formatting options.

0
source

Source: https://habr.com/ru/post/1236589/


All Articles