line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X::Base; |
2
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
4227
|
use strict; |
|
19
|
|
|
|
|
53
|
|
|
19
|
|
|
|
|
472
|
|
4
|
11
|
|
|
11
|
|
56
|
use warnings; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
230
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
50
|
use Carp (); |
|
11
|
|
|
|
|
31
|
|
|
11
|
|
|
|
|
3668
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1497
|
|
|
1497
|
0
|
3398
|
my ( $class, $string, $props_hr ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
1497
|
|
|
|
|
4545
|
$class->_check_overload(); |
12
|
|
|
|
|
|
|
|
13
|
1497
|
100
|
|
|
|
5146
|
my %attrs = $props_hr ? %$props_hr : (); |
14
|
|
|
|
|
|
|
|
15
|
1497
|
|
|
|
|
16423
|
return bless [ $string, \%attrs ], $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get { |
19
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $attr ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#Do we need to clone this? Could JSON suffice, or do we need Clone? |
22
|
0
|
|
|
|
|
0
|
return $self->[1]{$attr}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub to_string { |
26
|
330
|
|
|
330
|
0
|
24485
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
330
|
|
|
|
|
3646
|
return sprintf '%s: %s', ref($self), $self->[0]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my %_OVERLOADED; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _check_overload { |
36
|
1497
|
|
|
1497
|
|
2874
|
my ( $class, $str ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#cf. eval_bug.readme |
39
|
1497
|
|
|
|
|
2263
|
my $eval_err = $@; |
40
|
|
|
|
|
|
|
|
41
|
11
|
|
66
|
11
|
|
74
|
$_OVERLOADED{$class} ||= eval qq{ |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
226
|
|
|
1497
|
|
|
|
|
5209
|
|
42
|
|
|
|
|
|
|
package $class; |
43
|
|
|
|
|
|
|
use overload (q<""> => __PACKAGE__->can('__spew')); |
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#Should never happen as long as overload.pm is available. |
48
|
1497
|
50
|
|
|
|
3559
|
warn if !$_OVERLOADED{$class}; |
49
|
|
|
|
|
|
|
|
50
|
1497
|
|
|
|
|
2071
|
$@ = $eval_err; |
51
|
|
|
|
|
|
|
|
52
|
1497
|
|
|
|
|
2334
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub __spew { |
56
|
48
|
|
|
48
|
|
162
|
my ($self) = @_; |
57
|
|
|
|
|
|
|
|
58
|
48
|
|
|
|
|
129
|
my $spew = $self->to_string(); |
59
|
|
|
|
|
|
|
|
60
|
48
|
100
|
|
|
|
125
|
if ( substr( $spew, -1 ) ne "\n" ) { |
61
|
1
|
|
|
|
|
14
|
$spew .= Carp::longmess(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
48
|
|
|
|
|
1037
|
return $spew; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |