line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package My::Prefix::HashBase; |
2
|
1
|
|
|
1
|
|
1041
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '123'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
################################################################# |
8
|
|
|
|
|
|
|
# # |
9
|
|
|
|
|
|
|
# This is a generated file! Do not modify this file directly! # |
10
|
|
|
|
|
|
|
# Use hashbase_inc.pl script to regenerate this file. # |
11
|
|
|
|
|
|
|
# The script is part of the Object::HashBase distribution. # |
12
|
|
|
|
|
|
|
# Note: You can modify the version number above this comment # |
13
|
|
|
|
|
|
|
# if needed, that is fine. # |
14
|
|
|
|
|
|
|
# # |
15
|
|
|
|
|
|
|
################################################################# |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
{ |
18
|
1
|
|
|
1
|
|
4
|
no warnings 'once'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
85
|
|
19
|
|
|
|
|
|
|
$My::Prefix::HashBase::HB_VERSION = '0.006'; |
20
|
|
|
|
|
|
|
*My::Prefix::HashBase::ATTR_SUBS = \%Object::HashBase::ATTR_SUBS; |
21
|
|
|
|
|
|
|
*My::Prefix::HashBase::ATTR_LIST = \%Object::HashBase::ATTR_LIST; |
22
|
|
|
|
|
|
|
*My::Prefix::HashBase::VERSION = \%Object::HashBase::VERSION; |
23
|
|
|
|
|
|
|
*My::Prefix::HashBase::CAN_CACHE = \%Object::HashBase::CAN_CACHE; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
require Carp; |
28
|
|
|
|
|
|
|
{ |
29
|
1
|
|
|
1
|
|
5
|
no warnings 'once'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
87
|
|
30
|
|
|
|
|
|
|
$Carp::Internal{+__PACKAGE__} = 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
BEGIN { |
34
|
|
|
|
|
|
|
# these are not strictly equivalent, but for out use we don't care |
35
|
|
|
|
|
|
|
# about order |
36
|
|
|
|
|
|
|
*_isa = ($] >= 5.010 && require mro) ? \&mro::get_linear_isa : sub { |
37
|
1
|
|
|
1
|
|
8
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
38
|
0
|
|
|
|
|
0
|
my @packages = ($_[0]); |
39
|
0
|
|
|
|
|
0
|
my %seen; |
40
|
0
|
|
|
|
|
0
|
for my $package (@packages) { |
41
|
0
|
|
|
|
|
0
|
push @packages, grep !$seen{$_}++, @{"$package\::ISA"}; |
|
0
|
|
|
|
|
0
|
|
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
0
|
return \@packages; |
44
|
|
|
|
|
|
|
} |
45
|
1
|
50
|
33
|
1
|
|
345
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my %STRIP = ( |
48
|
|
|
|
|
|
|
'^' => 1, |
49
|
|
|
|
|
|
|
'-' => 1, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub import { |
53
|
2
|
|
|
2
|
|
2347
|
my $class = shift; |
54
|
2
|
|
|
|
|
4
|
my $into = caller; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Make sure we list the OLDEST version used to create this class. |
57
|
2
|
|
33
|
|
|
6
|
my $ver = $My::Prefix::HashBase::HB_VERSION || $My::Prefix::HashBase::VERSION; |
58
|
2
|
50
|
33
|
|
|
8
|
$My::Prefix::HashBase::VERSION{$into} = $ver if !$My::Prefix::HashBase::VERSION{$into} || $My::Prefix::HashBase::VERSION{$into} > $ver; |
59
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
9
|
my $isa = _isa($into); |
61
|
2
|
|
50
|
|
|
10
|
my $attr_list = $My::Prefix::HashBase::ATTR_LIST{$into} ||= []; |
62
|
2
|
|
50
|
|
|
189
|
my $attr_subs = $My::Prefix::HashBase::ATTR_SUBS{$into} ||= {}; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my %subs = ( |
65
|
|
|
|
|
|
|
($into->can('new') ? () : (new => \&_new)), |
66
|
1
|
50
|
|
|
|
6
|
(map %{$My::Prefix::HashBase::ATTR_SUBS{$_} || {}}, @{$isa}[1 .. $#$isa]), |
|
2
|
|
|
|
|
6
|
|
67
|
|
|
|
|
|
|
( |
68
|
|
|
|
|
|
|
map { |
69
|
2
|
100
|
|
|
|
22
|
my $p = substr($_, 0, 1); |
|
2
|
|
|
|
|
8
|
|
70
|
2
|
|
|
|
|
4
|
my $x = $_; |
71
|
2
|
50
|
|
|
|
6
|
substr($x, 0, 1) = '' if $STRIP{$p}; |
72
|
2
|
|
|
|
|
6
|
push @$attr_list => $x; |
73
|
2
|
|
|
|
|
5
|
my ($sub, $attr) = (uc $x, $x); |
74
|
0
|
|
|
0
|
|
0
|
$sub => ($attr_subs->{$sub} = sub() { $attr }), |
75
|
0
|
|
|
0
|
|
0
|
$attr => sub { $_[0]->{$attr} }, |
76
|
0
|
|
|
0
|
|
0
|
$p eq '-' ? ("set_$attr" => sub { Carp::croak("'$attr' is read-only") }) |
77
|
0
|
|
|
0
|
|
0
|
: $p eq '^' ? ("set_$attr" => sub { Carp::carp("set_$attr() is deprecated"); $_[0]->{$attr} = $_[1] }) |
|
0
|
|
|
|
|
0
|
|
78
|
2
|
50
|
|
0
|
|
60
|
: ("set_$attr" => sub { $_[0]->{$attr} = $_[1] }), |
|
0
|
50
|
|
|
|
0
|
|
79
|
|
|
|
|
|
|
} @_ |
80
|
|
|
|
|
|
|
), |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
409
|
|
84
|
2
|
|
|
|
|
9
|
*{"$into\::$_"} = $subs{$_} for keys %subs; |
|
8
|
|
|
|
|
26
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub attr_list { |
88
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $isa = _isa($class); |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my %seen; |
93
|
0
|
|
|
|
|
|
my @list = grep { !$seen{$_}++ } map { |
94
|
0
|
|
|
|
|
|
my @out; |
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
0
|
|
|
|
if (0.004 > ($My::Prefix::HashBase::VERSION{$_} || 0)) { |
97
|
0
|
|
|
|
|
|
Carp::carp("$_ uses an inlined version of My::Prefix::HashBase too old to support attr_list()"); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
else { |
100
|
0
|
|
|
|
|
|
my $list = $My::Prefix::HashBase::ATTR_LIST{$_}; |
101
|
0
|
0
|
|
|
|
|
@out = $list ? @$list : () |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
@out; |
105
|
|
|
|
|
|
|
} reverse @$isa; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
return @list; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _new { |
111
|
0
|
|
|
0
|
|
|
my $class = shift; |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my $self; |
114
|
|
|
|
|
|
|
|
115
|
0
|
0
|
|
|
|
|
if (@_ == 1) { |
116
|
0
|
|
|
|
|
|
my $arg = shift; |
117
|
0
|
|
|
|
|
|
my $type = ref($arg); |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
if ($type eq 'HASH') { |
120
|
0
|
|
|
|
|
|
$self = bless({%$arg}, $class) |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
else { |
123
|
0
|
0
|
|
|
|
|
Carp::croak("Not sure what to do with '$type' in $class constructor") |
124
|
|
|
|
|
|
|
unless $type eq 'ARRAY'; |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my %proto; |
127
|
0
|
|
|
|
|
|
my @attributes = attr_list($class); |
128
|
0
|
|
|
|
|
|
while (@$arg) { |
129
|
0
|
|
|
|
|
|
my $val = shift @$arg; |
130
|
0
|
0
|
|
|
|
|
my $key = shift @attributes or Carp::croak("Too many arguments for $class constructor"); |
131
|
0
|
|
|
|
|
|
$proto{$key} = $val; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$self = bless(\%proto, $class); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
else { |
138
|
0
|
|
|
|
|
|
$self = bless({@_}, $class); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$My::Prefix::HashBase::CAN_CACHE{$class} = $self->can('init') |
142
|
0
|
0
|
|
|
|
|
unless exists $My::Prefix::HashBase::CAN_CACHE{$class}; |
143
|
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
|
$self->init if $My::Prefix::HashBase::CAN_CACHE{$class}; |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
$self; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
__END__ |