| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Parse::HTTP::UserAgent::Base::Dumper; |
|
2
|
|
|
|
|
|
|
$Parse::HTTP::UserAgent::Base::Dumper::VERSION = '0.40_02'; # TRIAL |
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
15
|
$Parse::HTTP::UserAgent::Base::Dumper::VERSION = '0.4002';use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
53
|
|
|
5
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
68
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use Carp qw( croak ); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
100
|
|
|
7
|
2
|
|
|
2
|
|
13
|
use Parse::HTTP::UserAgent::Constants qw(:all); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1677
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub dumper { |
|
10
|
277
|
|
|
277
|
1
|
1961
|
my($self, @args) = @_; |
|
11
|
277
|
50
|
|
|
|
1352
|
my %opt = @args % 2 ? () : ( |
|
12
|
|
|
|
|
|
|
type => 'dumper', |
|
13
|
|
|
|
|
|
|
format => 'none', |
|
14
|
|
|
|
|
|
|
interpret => 0, |
|
15
|
|
|
|
|
|
|
@args |
|
16
|
|
|
|
|
|
|
); |
|
17
|
277
|
|
|
|
|
923
|
my $meth = '_dumper_' . lc $opt{type}; |
|
18
|
277
|
50
|
|
|
|
1219
|
croak "Don't know how to dump with $opt{type}" if ! $self->can( $meth ); |
|
19
|
277
|
|
|
|
|
821
|
my $buf = $self->$meth( \%opt ); |
|
20
|
277
|
50
|
|
|
|
1666
|
return $buf if defined wantarray; |
|
21
|
0
|
|
|
|
|
0
|
my $pok = print $buf ."\n"; |
|
22
|
0
|
|
|
|
|
0
|
return; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _dump_to_struct { |
|
26
|
0
|
|
|
0
|
|
0
|
my %struct = shift->as_hash; |
|
27
|
0
|
|
0
|
|
|
0
|
$struct{$_} ||= [] for qw( dotnet mozilla extras tk ); |
|
28
|
0
|
|
0
|
|
|
0
|
$struct{$_} ||= 0 for qw( unknown ); |
|
29
|
0
|
|
|
|
|
0
|
return \%struct; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _dumper_json { |
|
33
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
34
|
0
|
|
|
|
|
0
|
my $opt = shift; |
|
35
|
0
|
|
|
|
|
0
|
require JSON; |
|
36
|
|
|
|
|
|
|
return JSON::to_json( |
|
37
|
|
|
|
|
|
|
$self->_dump_to_struct, |
|
38
|
0
|
|
|
|
|
0
|
{ pretty => $opt->{format} eq 'pretty' } |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _dumper_xml { |
|
43
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
44
|
0
|
|
|
|
|
0
|
my $opt = shift; |
|
45
|
0
|
|
|
|
|
0
|
require XML::Simple; |
|
46
|
|
|
|
|
|
|
return XML::Simple::XMLout( |
|
47
|
|
|
|
|
|
|
$self->_dump_to_struct, |
|
48
|
|
|
|
|
|
|
RootName => 'ua', |
|
49
|
0
|
|
|
|
|
0
|
NoIndent => $opt->{format} ne 'pretty', |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _dumper_yaml { |
|
54
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
55
|
0
|
|
|
|
|
0
|
my $opt = shift; |
|
56
|
0
|
|
|
|
|
0
|
require YAML; |
|
57
|
0
|
|
|
|
|
0
|
return YAML::Dump( $self->_dump_to_struct ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _dumper_dumper { |
|
61
|
|
|
|
|
|
|
# yeah, I know. Fugly code here |
|
62
|
277
|
|
|
277
|
|
486
|
my $self = shift; |
|
63
|
277
|
|
|
|
|
466
|
my $opt = shift; |
|
64
|
277
|
50
|
|
|
|
1064
|
my @ids = $opt->{args} ? @{ $opt->{args} } : $self->_object_ids; |
|
|
0
|
|
|
|
|
0
|
|
|
65
|
277
|
50
|
|
|
|
1686
|
my $args = $opt->{args} ? 1 : 0; |
|
66
|
277
|
|
|
|
|
391
|
my $max = 0; |
|
67
|
277
|
100
|
|
|
|
445
|
map { $max = length $_ if length $_ > $max; } @ids; |
|
|
6371
|
|
|
|
|
11914
|
|
|
68
|
277
|
|
|
|
|
489
|
my @titles = qw( FIELD VALUE ); |
|
69
|
277
|
|
|
|
|
1500
|
my $buf = sprintf "%s%s%s\n%s%s%s\n", |
|
70
|
|
|
|
|
|
|
$titles[0], |
|
71
|
|
|
|
|
|
|
(q{ } x (2 + $max - length $titles[0])), |
|
72
|
|
|
|
|
|
|
$titles[1], |
|
73
|
|
|
|
|
|
|
q{-} x $max, q{ } x 2, q{-} x ($max*2); |
|
74
|
277
|
|
|
|
|
1991
|
require Data::Dumper; |
|
75
|
277
|
|
|
|
|
5743
|
my @buf; |
|
76
|
277
|
|
|
|
|
514
|
foreach my $id ( @ids ) { |
|
77
|
6371
|
50
|
|
|
|
9670
|
my $name = $args ? $id->{name} : $id; |
|
78
|
6371
|
50
|
|
|
|
13735
|
my $val = $args ? $id->{value} : $self->[ $self->$id() ]; |
|
79
|
6371
|
100
|
100
|
|
|
12922
|
if ( $val && ref $val ) { |
|
80
|
412
|
|
|
|
|
1306
|
my $d = Data::Dumper->new([$val]); |
|
81
|
412
|
|
|
|
|
9150
|
$d->Indent(0); |
|
82
|
412
|
|
|
|
|
4071
|
my $rv = $d->Dump; |
|
83
|
412
|
|
|
|
|
9149
|
$rv =~ s{ \$VAR1 \s+ = \s+ }{}xms; |
|
84
|
412
|
|
|
|
|
1140
|
$rv =~ s{ ; }{}xms; |
|
85
|
412
|
50
|
|
|
|
2298
|
$val = $rv eq '[]' ? q{} : $rv; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
6371
|
100
|
|
|
|
17514
|
push @buf, [ |
|
88
|
|
|
|
|
|
|
$name, |
|
89
|
|
|
|
|
|
|
(q{ } x (2 + $max - length $name)), |
|
90
|
|
|
|
|
|
|
defined $val ? $val : q{} |
|
91
|
|
|
|
|
|
|
]; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
277
|
|
|
|
|
975
|
foreach my $row ( sort { lc $a->[0] cmp lc $b->[0] } @buf ) { |
|
|
22076
|
|
|
|
|
29998
|
|
|
94
|
6371
|
|
|
|
|
7756
|
$buf .= sprintf "%s%s%s\n", @{ $row }; |
|
|
6371
|
|
|
|
|
11934
|
|
|
95
|
|
|
|
|
|
|
} |
|
96
|
277
|
|
|
|
|
2376
|
return $buf; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |