This file is indexed.

/usr/share/perl5/autobox/dump.pm is in libautobox-dump-perl 20090426.1746-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package autobox::dump;
# vi: ht=4 sw=4 ts=4 et :

use warnings;
use strict;

use base "autobox";

our $VERSION = '20090426.1746';

our @options = qw/Indent Terse Useqq Sortkeys Deparse/;

sub options {
    #let them call it autobox::dump::options or autobox::dump->options
    shift @_ if $_[0] eq 'autobox::dump';
    @options = @_;
}

sub import {
    my $class = shift;

    my $dumper = "autobox::dump::inner";

    $class->SUPER::import(
        SCALAR => $dumper,
        ARRAY  => $dumper,
        HASH   => $dumper,
        CODE   => $dumper,
    );
}

{
    package autobox::dump::inner;

    sub perl {
        require Data::Dumper;
        #use Test::More;

        my $self    = shift;
        my @options = @_ ? @_ : @autobox::dump::options;

        my $dumper = Data::Dumper->new([$self]);

        for my $option (@options) {
            my ($opt, @opt_args) = ref $option ? @$option : ($option, 1);
                
            $dumper->$opt(@opt_args) if $dumper->can($opt);
        }

        return $dumper->Dump;
    }
}


=head1 NAME

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

=head1 VERSION

Version 20090426.1746

=head1 SYNOPSIS

The autobox::dump pragma adds, via the autobox pragma, a method to 
normal expression (such as scalars, arrays, hashes, math, literals, etc.)
that produces a human/perl readable representation of the value of that
expression. 


    use autobox::dump;

    my $foo = "foo";
    print $foo->perl;   # "foo";

    print +(5*6)->perl; # 30;

    my @a = (1..3);

    print @a->perl;
    # [
    #  1,
    #  2,
    #  3
    # ];

    print {a=>1, b=>2}->perl;
    # {
    #  "a" => 1,
    #  "b" => 2
    # };
    
    sub func {
        my ($x, $y) = @_;
        return $x + $y;
    }

    my $func = \&func;
    print $func->perl;
    #sub {
    #    BEGIN {
    #        $^H{'autobox_scope'} = q(154456408);
    #        $^H{'autobox'} = q(HASH(0x93a3e00));
    #        $^H{'autobox_leave'} = q(Scope::Guard=ARRAY(0x9435078));
    #    }
    #    my($x, $y) = @_;
    #    return $x + $y;
    #}
    
    You can set Data::Dumper options by passing either arrayrefs of option
    and value pairs or just keys (in which case the option will be set to
    1).  The default options are C<qw/Indent Terse Useqq Sortkeys Deparse/>.

    print ["a", 0, 1]->perl([Indent => 3], [Varname => "a"], qw/Useqq/);
    #$a1 = [
    #        #0
    #        "a",
    #        #1
    #        0,
    #        #2
    #        1
    #      ];

    You can also call the class method ->options to set a different default.

    #set Indent to 0, but leave the rest of the options
    autobox::dump->options([Indent => 0], qw/Terse Useqq Sortkeys Deparse/);

    print ["a", 0, 1]->perl; #["a",0,1]

=head1 AUTHOR

Chas. J Owens IV, C<< <chas.owens at gmail.com> >>

=head1 BUGS

Has all the issues L<autobox> has.

Has all the issues L<Data::Dumper> has.

This pragma errs on the side of human readable to the detriment of
Perl readable.  In particular it uses the terse and deparse options
of Data::Dumper by default.  These options may create code that cannot 
be eval'ed.  For best eval results, set options to C<qw/Purity/>.
Note, this turns off coderef dumping.

Please report any bugs or feature requests to 
http://github.com/cowens/autobox-dump/issues

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc autobox::dump

=head1 ACKNOWLEDGEMENTS

Michael Schwern for starting the perl5i pragma which prompted me to add
a feature I wanted to autobox.

=head1 COPYRIGHT & LICENSE

Copyright 2009 Chas. J Owens IV, all rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut

1; # End of autobox::dump