1autobox::dump(3)      User Contributed Perl Documentation     autobox::dump(3)
2
3
4

NAME

6       autobox::dump - human/perl readable strings from the results of an EXPR
7

VERSION

9       Version 20090426.1746
10

SYNOPSIS

12       The autobox::dump pragma adds, via the autobox pragma, a method to
13       normal expression (such as scalars, arrays, hashes, math, literals,
14       etc.)  that produces a human/perl readable representation of the value
15       of that expression.
16
17           use autobox::dump;
18
19           my $foo = "foo";
20           print $foo->perl;   # "foo";
21
22           print +(5*6)->perl; # 30;
23
24           my @a = (1..3);
25
26           print @a->perl;
27           # [
28           #  1,
29           #  2,
30           #  3
31           # ];
32
33           print {a=>1, b=>2}->perl;
34           # {
35           #  "a" => 1,
36           #  "b" => 2
37           # };
38
39           sub func {
40               my ($x, $y) = @_;
41               return $x + $y;
42           }
43
44           my $func = \&func;
45           print $func->perl;
46           #sub {
47           #    BEGIN {
48           #        $^H{'autobox_scope'} = q(154456408);
49           #        $^H{'autobox'} = q(HASH(0x93a3e00));
50           #        $^H{'autobox_leave'} = q(Scope::Guard=ARRAY(0x9435078));
51           #    }
52           #    my($x, $y) = @_;
53           #    return $x + $y;
54           #}
55
56           You can set Data::Dumper options by passing either arrayrefs of option
57           and value pairs or just keys (in which case the option will be set to
58           1).  The default options are C<qw/Indent Terse Useqq Sortkeys Deparse/>.
59
60           print ["a", 0, 1]->perl([Indent => 3], [Varname => "a"], qw/Useqq/);
61           #$a1 = [
62           #        #0
63           #        "a",
64           #        #1
65           #        0,
66           #        #2
67           #        1
68           #      ];
69
70           You can also call the class method ->options to set a different default.
71
72           #set Indent to 0, but leave the rest of the options
73           autobox::dump->options([Indent => 0], qw/Terse Useqq Sortkeys Deparse/);
74
75           print ["a", 0, 1]->perl; #["a",0,1]
76

AUTHOR

78       Chas. J Owens IV, "<chas.owens at gmail.com>"
79

BUGS

81       Has all the issues autobox has.
82
83       Has all the issues Data::Dumper has.
84
85       This pragma errs on the side of human readable to the detriment of Perl
86       readable.  In particular it uses the terse and deparse options of
87       Data::Dumper by default.  These options may create code that cannot be
88       eval'ed.  For best eval results, set options to "qw/Purity/".  Note,
89       this turns off coderef dumping.
90
91       Please report any bugs or feature requests to
92       http://github.com/cowens/autobox-dump/issues
93

SUPPORT

95       You can find documentation for this module with the perldoc command.
96
97           perldoc autobox::dump
98

ACKNOWLEDGEMENTS

100       Michael Schwern for starting the perl5i pragma which prompted me to add
101       a feature I wanted to autobox.
102
104       Copyright 2009 Chas. J Owens IV, all rights reserved.
105
106       This program is free software; you can redistribute it and/or modify it
107       under the same terms as Perl itself.
108
109
110
111perl v5.28.0                      2009-04-26                  autobox::dump(3)
Impressum