line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Data::Dumper::Again;
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
114748
|
use strict;
|
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
198
|
|
6
|
5
|
|
|
5
|
|
27
|
use warnings;
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
251
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.0002';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# for docs, look for F
|
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
5735
|
use Data::Dumper ();
|
|
5
|
|
|
|
|
54187
|
|
|
5
|
|
|
|
|
150
|
|
13
|
5
|
|
|
5
|
|
45
|
use Carp qw(carp croak);
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
364
|
|
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
|
26
|
use base qw(Class::Accessor);
|
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
4832
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(ddumper));
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# the instance variables
|
19
|
|
|
|
|
|
|
# ddumper - the Data::Dumper inner object
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new {
|
22
|
5
|
|
|
5
|
1
|
3256
|
my $proto = shift;
|
23
|
5
|
|
33
|
|
|
40
|
my $class = ref $proto || $proto;
|
24
|
5
|
|
|
|
|
21
|
my $obj = bless {}, $class;
|
25
|
5
|
|
|
|
|
20
|
return $obj->_init(@_);
|
26
|
|
|
|
|
|
|
}
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _init {
|
29
|
5
|
|
|
5
|
|
11
|
my $self = shift;
|
30
|
5
|
|
|
|
|
14
|
my %args = @_;
|
31
|
|
|
|
|
|
|
|
32
|
5
|
|
|
|
|
35
|
my $dumper = Data::Dumper->new([]);
|
33
|
|
|
|
|
|
|
|
34
|
5
|
|
|
|
|
200
|
while (my ($k, $v) = each %args) {
|
35
|
2
|
|
|
|
|
23
|
my $p = "\u$k"; # turn into a method name
|
36
|
2
|
50
|
|
|
|
18
|
if ($dumper->can($p)) {
|
37
|
|
|
|
|
|
|
#print "invoke $p($v)\n"; # XXX debug for devel
|
38
|
2
|
|
|
|
|
10
|
$dumper->$p($v);
|
39
|
|
|
|
|
|
|
} else {
|
40
|
0
|
|
|
|
|
0
|
carp "unknown constructor parameter '$k'";
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
}
|
43
|
5
|
|
|
|
|
41
|
$self->ddumper($dumper);
|
44
|
5
|
|
|
|
|
119
|
return $self;
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub guts {
|
48
|
2
|
|
|
2
|
1
|
1725
|
return shift->ddumper;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# $vname = $self->_varname($wantarray);
|
52
|
|
|
|
|
|
|
sub _varname {
|
53
|
5
|
|
|
5
|
|
7
|
my $self = shift;
|
54
|
5
|
|
|
|
|
6
|
my $wantarray = shift;
|
55
|
5
|
|
|
|
|
16
|
my $varname = $self->ddumper->Varname;
|
56
|
5
|
100
|
|
|
|
92
|
return ( $wantarray ? '*' : '$' ) . $varname;
|
57
|
|
|
|
|
|
|
}
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# $s = $self->_raw_dump(\@values, \@names);
|
60
|
|
|
|
|
|
|
sub _raw_dump {
|
61
|
6
|
|
|
6
|
|
10
|
my $self = shift;
|
62
|
6
|
|
|
|
|
9
|
my $values_ref = shift;
|
63
|
6
|
|
|
|
|
9
|
my $names_ref = shift;
|
64
|
6
|
|
|
|
|
20
|
$self->ddumper->Reset; # forget previous invocations
|
65
|
6
|
|
|
|
|
109
|
$self->ddumper->Values( $values_ref );
|
66
|
6
|
|
|
|
|
160
|
$self->ddumper->Names( $names_ref );
|
67
|
6
|
|
|
|
|
106
|
return $self->ddumper->Dump;
|
68
|
|
|
|
|
|
|
}
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub dump {
|
71
|
5
|
|
|
5
|
1
|
2178
|
my $self = shift;
|
72
|
5
|
|
|
|
|
10
|
my $wantarray = @_ != 1;
|
73
|
5
|
100
|
|
|
|
18
|
my @values = ( $wantarray ? \@_ : shift );
|
74
|
5
|
|
|
|
|
13
|
my @names = ( $self->_varname($wantarray) );
|
75
|
5
|
|
|
|
|
14
|
return $self->_raw_dump(\@values, \@names);
|
76
|
|
|
|
|
|
|
}
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub dump_scalar {
|
79
|
0
|
|
|
0
|
1
|
0
|
my $self = shift;
|
80
|
0
|
|
|
|
|
0
|
my @values = ( shift );
|
81
|
0
|
|
|
|
|
0
|
my @names = ( $self->_varname(0) ); # wantarray => 0
|
82
|
0
|
|
|
|
|
0
|
return $self->_raw_dump(\@values, \@names);
|
83
|
|
|
|
|
|
|
}
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub dump_list {
|
86
|
0
|
|
|
0
|
1
|
0
|
my $self = shift;
|
87
|
0
|
|
|
|
|
0
|
my @values = ( \@_ );
|
88
|
0
|
|
|
|
|
0
|
my @names = ( $self->_varname(1) ); # wantarray => 1
|
89
|
0
|
|
|
|
|
0
|
return $self->_raw_dump(\@values, \@names);
|
90
|
|
|
|
|
|
|
}
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub dump_named {
|
93
|
1
|
|
|
1
|
1
|
801
|
my $self = shift;
|
94
|
1
|
|
|
|
|
4
|
my @pairs = @_;
|
95
|
1
|
|
|
|
|
2
|
my (@names, @values);
|
96
|
1
|
|
|
|
|
7
|
while (@pairs) {
|
97
|
1
|
|
|
|
|
4
|
my ($n, $v) = splice @pairs, 0, 2;
|
98
|
1
|
|
|
|
|
4
|
push @names, $n;
|
99
|
1
|
|
|
|
|
4
|
push @values, $v;
|
100
|
|
|
|
|
|
|
}
|
101
|
1
|
|
|
|
|
6
|
return $self->_raw_dump(\@values, \@names);
|
102
|
|
|
|
|
|
|
}
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# the following AUTOLOAD sub implements set_*
|
105
|
|
|
|
|
|
|
# and get_* methods
|
106
|
|
|
|
|
|
|
|
107
|
5
|
|
|
5
|
|
13766
|
use vars qw($AUTOLOAD);
|
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1359
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub AUTOLOAD {
|
110
|
0
|
|
|
0
|
|
|
my $self = shift;
|
111
|
0
|
|
|
|
|
|
my $method = $AUTOLOAD;
|
112
|
0
|
|
|
|
|
|
$method =~ s/.*:://;
|
113
|
0
|
0
|
|
|
|
|
if ($method =~ /[gs]et_(\w+)/) {
|
114
|
0
|
|
|
|
|
|
my $prop = "\u$1";
|
115
|
0
|
0
|
|
|
|
|
if ($self->ddumper->can($prop)) {
|
116
|
0
|
|
|
|
|
|
return $self->ddumper->$prop(@_);
|
117
|
|
|
|
|
|
|
} else {
|
118
|
0
|
|
|
|
|
|
croak "unknown getter/setter method '$method'"; # XXX
|
119
|
|
|
|
|
|
|
}
|
120
|
|
|
|
|
|
|
}
|
121
|
0
|
|
|
|
|
|
croak "unknown method '$method'"; # XXX
|
122
|
|
|
|
|
|
|
}
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# this avoids invoking AUTOLOAD on destruction
|
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
0
|
|
|
sub DESTROY {}
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1;
|
129
|
|
|
|
|
|
|
|