line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
1
|
|
|
1
|
|
5
|
package Test2::Util::HashBase; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
3
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
################################################################# |
7
|
|
|
|
|
|
|
# # |
8
|
|
|
|
|
|
|
# This is a generated file! Do not modify this file directly! # |
9
|
|
|
|
|
|
|
# Use hashbase_inc.pl script to regenerate this file. # |
10
|
|
|
|
|
|
|
# The script is part of the Object::HashBase distribution. # |
11
|
|
|
|
|
|
|
# # |
12
|
|
|
|
|
|
|
################################################################# |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
3
|
{ |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
15
|
|
|
|
|
|
|
no warnings 'once'; |
16
|
|
|
|
|
|
|
$Test2::Util::HashBase::VERSION = '0.002'; |
17
|
|
|
|
|
|
|
*Test2::Util::HashBase::ATTR_SUBS = \%Object::HashBase::ATTR_SUBS; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
require Carp; |
22
|
1
|
|
|
1
|
|
4
|
{ |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
71
|
|
23
|
|
|
|
|
|
|
no warnings 'once'; |
24
|
|
|
|
|
|
|
$Carp::Internal{+__PACKAGE__} = 1; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
BEGIN { |
28
|
|
|
|
|
|
|
# these are not strictly equivalent, but for out use we don't care |
29
|
|
|
|
|
|
|
# about order |
30
|
1
|
|
|
1
|
|
4
|
*_isa = ($] >= 5.010 && require mro) ? \&mro::get_linear_isa : sub { |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
93
|
|
31
|
0
|
|
|
|
|
0
|
no strict 'refs'; |
32
|
0
|
|
|
|
|
0
|
my @packages = ($_[0]); |
33
|
0
|
|
|
|
|
0
|
my %seen; |
34
|
0
|
|
|
|
|
0
|
for my $package (@packages) { |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
push @packages, grep !$seen{$_}++, @{"$package\::ISA"}; |
36
|
0
|
|
|
|
|
0
|
} |
37
|
|
|
|
|
|
|
return \@packages; |
38
|
1
|
50
|
33
|
1
|
|
389
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my %STRIP = ( |
42
|
|
|
|
|
|
|
'^' => 1, |
43
|
|
|
|
|
|
|
'-' => 1, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
18
|
|
|
18
|
|
354
|
sub import { |
47
|
18
|
|
|
|
|
26
|
my $class = shift; |
48
|
|
|
|
|
|
|
my $into = caller; |
49
|
18
|
|
|
|
|
58
|
|
50
|
18
|
|
50
|
|
|
75
|
my $isa = _isa($into); |
51
|
|
|
|
|
|
|
my $attr_subs = $Test2::Util::HashBase::ATTR_SUBS{$into} ||= {}; |
52
|
|
|
|
|
|
|
my %subs = ( |
53
|
15
|
100
|
|
|
|
70
|
($into->can('new') ? () : (new => \&_new)), |
|
18
|
|
|
|
|
33
|
|
54
|
|
|
|
|
|
|
(map %{$Test2::Util::HashBase::ATTR_SUBS{$_} || {}}, @{$isa}[1 .. $#$isa]), |
55
|
|
|
|
|
|
|
( |
56
|
18
|
100
|
|
|
|
134
|
map { |
|
88
|
|
|
|
|
130
|
|
57
|
88
|
|
|
|
|
80
|
my $p = substr($_, 0, 1); |
58
|
88
|
50
|
|
|
|
109
|
my $x = $_; |
59
|
88
|
|
|
|
|
147
|
substr($x, 0, 1) = '' if $STRIP{$p}; |
60
|
0
|
|
|
0
|
|
0
|
my ($sub, $attr) = (uc $x, $x); |
61
|
38
|
|
|
38
|
|
121
|
$sub => ($attr_subs->{$sub} = sub() { $attr }), |
62
|
0
|
|
|
0
|
|
0
|
$attr => sub { $_[0]->{$attr} }, |
63
|
0
|
|
|
0
|
|
0
|
$p eq '-' ? ("set_$attr" => sub { Carp::croak("'$attr' is read-only") }) |
|
0
|
|
|
|
|
0
|
|
64
|
88
|
50
|
|
4
|
|
806
|
: $p eq '^' ? ("set_$attr" => sub { Carp::carp("set_$attr() is deprecated"); $_[0]->{$attr} = $_[1] }) |
|
4
|
50
|
|
|
|
10
|
|
65
|
|
|
|
|
|
|
: ("set_$attr" => sub { $_[0]->{$attr} = $_[1] }), |
66
|
|
|
|
|
|
|
} @_ |
67
|
|
|
|
|
|
|
), |
68
|
|
|
|
|
|
|
); |
69
|
1
|
|
|
1
|
|
851
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
120
|
|
70
|
18
|
|
|
|
|
95
|
no strict 'refs'; |
|
357
|
|
|
|
|
5282
|
|
71
|
|
|
|
|
|
|
*{"$into\::$_"} = $subs{$_} for keys %subs; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
6
|
|
|
6
|
|
18
|
sub _new { |
75
|
6
|
|
|
|
|
11
|
my ($class, %params) = @_; |
76
|
6
|
50
|
|
|
|
43
|
my $self = bless \%params, $class; |
77
|
6
|
|
|
|
|
56
|
$self->init if $self->can('init'); |
78
|
|
|
|
|
|
|
$self; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |