NAME
Data::Dumper::LispLike - Dump perl data structures formatted as Lisp-like S-expressions
VERSION
version 0.001
SYNOPSIS
use Data::Dumper::LispLike;
print dumplisp [ 1, 2, [3, 4] ]; # prints "(1 2 (3 4))\n";
FUNCTIONS
dumplisp
my $listref = ...;
print dumplisp $listref;
This function converts an ARRAYREF
, which may contain strings or other ARRAYREF
s, into Lisp-like S-expressions. The output is much compacter and easier to read than the output of Data::Dumper
.
EXAMPLE
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)))
SUPPORT
http://github.com/spiculator/data-dumper-lisplike
AUTHOR
Sergey Redin <sergey@redin.info>
COPYRIGHT AND LICENSE
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.