Data::Dumper::LispLike - Dump perl data structures formatted as Lisp-like S-expressions
version 0.001
use Data::Dumper::LispLike; print dumplisp [ 1, 2, [3, 4] ]; # prints "(1 2 (3 4))\n";
my $listref = ...; print dumplisp $listref;
This function converts an ARRAYREF, which may contain strings or other ARRAYREFs, into Lisp-like S-expressions. The output is much compacter and easier to read than the output of Data::Dumper.
ARRAYREF
Data::Dumper
Here is a bigger real-life example of dumplisp() output:
(COMMA (AND (CMDDEF echo (%str) (BLOCK (CMDRUN printf '%str\n'))) (CMDDEF echo1 (%STR) (BLOCK (CMDRUN print1 '%STR\n'))) (CMDDEF kill () (BLOCK (CMDRUN signal KILL))) (CMDDEF term () (BLOCK (CMDRUN signal TERM))) (CMDDEF hup () (BLOCK (CMDRUN signal HUP))) (CMDDEF ps () (BLOCK (CMDRUN exec ps uf '{}'))) (CMDDEF pso (%PS_FIELDS) (BLOCK (CMDRUN exec ps '-o\-' %PS_FIELDS '{}'))) (CMDDEF exe (%exe_arg) (BLOCK (COMPARE == %exe %exe_arg))) (CMDDEF cwd (%cwd_arg) (BLOCK (COMPARE == %cwd %cwd_arg))) (ASSIGN %vsz %statm::size) (ASSIGN %rss %statm::resident) (CMDDEF kthread () (BLOCK (COMPARE == 0 %rss))) (CMDDEF userspace () (BLOCK (NOT (CMDRUN kthread)))) (ASSIGN %ppid %stat::ppid) (ASSIGN %comm %stat::comm) (ASSIGN %state %stat::state)) (AND (BLOCK (OR (CMDRUN userspace) (COMPARE == %pid 2))) (AND (BLOCK (OR (CMDRUN userspace) (COMPARE == %pid 23))) (CMDRUN ps)))
http://github.com/spiculator/data-dumper-lisplike
Sergey Redin <sergey@redin.info>
This software is copyright (c) 2012 by Sergey Redin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::Dumper::LispLike, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Dumper::LispLike
CPAN shell
perl -MCPAN -e shell install Data::Dumper::LispLike
For more information on module installation, please visit the detailed CPAN module installation guide.