line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::X::Base; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
4000
|
use strict; |
|
17
|
|
|
|
|
53
|
|
|
17
|
|
|
|
|
480
|
|
4
|
10
|
|
|
10
|
|
50
|
use warnings; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
199
|
|
5
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
65
|
use Carp (); |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
3234
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1210
|
|
|
1210
|
0
|
3296
|
my ( $class, $string, $props_hr ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
1210
|
|
|
|
|
4212
|
$class->_check_overload(); |
12
|
|
|
|
|
|
|
|
13
|
1210
|
100
|
|
|
|
3997
|
my %attrs = $props_hr ? %$props_hr : (); |
14
|
|
|
|
|
|
|
|
15
|
1210
|
|
|
|
|
15109
|
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
|
320
|
|
|
320
|
0
|
22764
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
320
|
|
|
|
|
4507
|
return sprintf '%s: %s', ref($self), $self->[0]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my %_OVERLOADED; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _check_overload { |
36
|
1210
|
|
|
1210
|
|
2809
|
my ( $class, $str ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#cf. eval_bug.readme |
39
|
1210
|
|
|
|
|
1961
|
my $eval_err = $@; |
40
|
|
|
|
|
|
|
|
41
|
10
|
|
66
|
10
|
|
68
|
$_OVERLOADED{$class} ||= eval qq{ |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
180
|
|
|
1210
|
|
|
|
|
4496
|
|
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
|
1210
|
50
|
|
|
|
2776
|
warn if !$_OVERLOADED{$class}; |
49
|
|
|
|
|
|
|
|
50
|
1210
|
|
|
|
|
1746
|
$@ = $eval_err; |
51
|
|
|
|
|
|
|
|
52
|
1210
|
|
|
|
|
1925
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub __spew { |
56
|
38
|
|
|
38
|
|
130
|
my ($self) = @_; |
57
|
|
|
|
|
|
|
|
58
|
38
|
|
|
|
|
85
|
my $spew = $self->to_string(); |
59
|
|
|
|
|
|
|
|
60
|
38
|
100
|
|
|
|
119
|
if ( substr( $spew, -1 ) ne "\n" ) { |
61
|
1
|
|
|
|
|
13
|
$spew .= Carp::longmess(); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
38
|
|
|
|
|
868
|
return $spew; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |