line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::Merge::Extra; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
359870
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
230
|
|
4
|
8
|
|
|
8
|
|
38
|
use warnings FATAL => 'all'; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
329
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
583
|
use Hash::Merge qw(_merge_hashes); |
|
8
|
|
|
|
|
4224
|
|
|
8
|
|
|
|
|
1647
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; # Don't forget to change in pod below |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use constant L_ADDITIVE => { |
11
|
|
|
|
|
|
|
'SCALAR' => { |
12
|
3
|
100
|
|
|
|
3424
|
'SCALAR' => sub { defined $_[0] ? $_[0] : $_[1] }, |
13
|
2
|
100
|
|
|
|
1223
|
'ARRAY' => sub { defined $_[0] ? $_[0] : $_[1] }, |
14
|
2
|
100
|
|
|
|
1033
|
'HASH' => sub { defined $_[0] ? $_[0] : $_[1] }, |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
'ARRAY' => { |
17
|
1
|
|
|
|
|
949
|
'SCALAR' => sub { $_[0] }, |
18
|
1
|
|
|
|
|
600
|
'ARRAY' => sub { [ @{$_[0]}, @{$_[1]} ] }, |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
19
|
1
|
|
|
|
|
494
|
'HASH' => sub { $_[0] }, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
'HASH' => { |
22
|
1
|
|
|
|
|
537
|
'SCALAR' => sub { $_[0] }, |
23
|
1
|
|
|
|
|
549
|
'ARRAY' => sub { $_[0] }, |
24
|
1
|
|
|
|
|
557
|
'HASH' => sub { _merge_hashes(@_) }, |
25
|
|
|
|
|
|
|
}, |
26
|
8
|
|
|
8
|
|
54
|
}; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
1844
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use constant R_ADDITIVE => { |
29
|
|
|
|
|
|
|
'SCALAR' => { |
30
|
3
|
100
|
|
|
|
3812
|
'SCALAR' => sub { defined $_[1] ? $_[1] : $_[0] }, |
31
|
1
|
|
|
|
|
671
|
'ARRAY' => sub { $_[1] }, |
32
|
1
|
|
|
|
|
570
|
'HASH' => sub { $_[1] }, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
'ARRAY' => { |
35
|
2
|
100
|
|
|
|
1168
|
'SCALAR' => sub { defined $_[1] ? $_[1] : $_[0] }, |
36
|
1
|
|
|
|
|
650
|
'ARRAY' => sub { [ @{$_[1]}, @{$_[0]} ] }, |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
37
|
1
|
|
|
|
|
566
|
'HASH' => sub { $_[1] }, |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
'HASH' => { |
40
|
2
|
100
|
|
|
|
1103
|
'SCALAR' => sub { defined $_[1] ? $_[1] : $_[0] }, |
41
|
1
|
|
|
|
|
624
|
'ARRAY' => sub { $_[1] }, |
42
|
1
|
|
|
|
|
605
|
'HASH' => sub { _merge_hashes(@_) }, |
43
|
|
|
|
|
|
|
}, |
44
|
8
|
|
|
8
|
|
50
|
}; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
1389
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use constant L_OVERRIDE => { |
47
|
|
|
|
|
|
|
'SCALAR' => { |
48
|
2
|
|
|
|
|
2687
|
'SCALAR' => sub { $_[0] }, |
49
|
1
|
|
|
|
|
712
|
'ARRAY' => sub { $_[0] }, |
50
|
1
|
|
|
|
|
604
|
'HASH' => sub { $_[0] }, |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
'ARRAY' => { |
53
|
1
|
|
|
|
|
582
|
'SCALAR' => sub { $_[0] }, |
54
|
1
|
|
|
|
|
602
|
'ARRAY' => sub { $_[0] }, |
55
|
1
|
|
|
|
|
632
|
'HASH' => sub { $_[0] }, |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
'HASH' => { |
58
|
1
|
|
|
|
|
537
|
'SCALAR' => sub { $_[0] }, |
59
|
1
|
|
|
|
|
580
|
'ARRAY' => sub { $_[0] }, |
60
|
1
|
|
|
|
|
614
|
'HASH' => sub { _merge_hashes(@_) }, |
61
|
|
|
|
|
|
|
}, |
62
|
8
|
|
|
8
|
|
46
|
}; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
1581
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use constant R_OVERRIDE => { |
65
|
|
|
|
|
|
|
'SCALAR' => { |
66
|
2
|
|
|
|
|
2627
|
'SCALAR' => sub { $_[1] }, |
67
|
1
|
|
|
|
|
664
|
'ARRAY' => sub { $_[1] }, |
68
|
1
|
|
|
|
|
541
|
'HASH' => sub { $_[1] }, |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
'ARRAY' => { |
71
|
1
|
|
|
|
|
577
|
'SCALAR' => sub { $_[1] }, |
72
|
1
|
|
|
|
|
639
|
'ARRAY' => sub { $_[1] }, |
73
|
1
|
|
|
|
|
546
|
'HASH' => sub { $_[1] }, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
'HASH' => { |
76
|
1
|
|
|
|
|
548
|
'SCALAR' => sub { $_[1] }, |
77
|
1
|
|
|
|
|
612
|
'ARRAY' => sub { $_[1] }, |
78
|
1
|
|
|
|
|
572
|
'HASH' => sub { _merge_hashes(@_) }, |
79
|
|
|
|
|
|
|
}, |
80
|
8
|
|
|
8
|
|
46
|
}; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
1298
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
use constant L_REPLACE => { |
83
|
|
|
|
|
|
|
'SCALAR' => { |
84
|
1
|
|
|
|
|
4305
|
'SCALAR' => sub { $_[0] }, |
85
|
1
|
|
|
|
|
1229
|
'ARRAY' => sub { $_[0] }, |
86
|
1
|
|
|
|
|
919
|
'HASH' => sub { $_[0] }, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
'ARRAY' => { |
89
|
1
|
|
|
|
|
888
|
'SCALAR' => sub { $_[0] }, |
90
|
1
|
|
|
|
|
883
|
'ARRAY' => sub { $_[0] }, |
91
|
1
|
|
|
|
|
774
|
'HASH' => sub { $_[0] }, |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
'HASH' => { |
94
|
1
|
|
|
|
|
746
|
'SCALAR' => sub { $_[0] }, |
95
|
1
|
|
|
|
|
741
|
'ARRAY' => sub { $_[0] }, |
96
|
1
|
|
|
|
|
724
|
'HASH' => sub { $_[0] }, |
97
|
|
|
|
|
|
|
}, |
98
|
8
|
|
|
8
|
|
43
|
}; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
1403
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
use constant R_REPLACE => { |
101
|
|
|
|
|
|
|
'SCALAR' => { |
102
|
1
|
|
|
|
|
2470
|
'SCALAR' => sub { $_[1] }, |
103
|
1
|
|
|
|
|
601
|
'ARRAY' => sub { $_[1] }, |
104
|
1
|
|
|
|
|
530
|
'HASH' => sub { $_[1] }, |
105
|
|
|
|
|
|
|
}, |
106
|
|
|
|
|
|
|
'ARRAY' => { |
107
|
1
|
|
|
|
|
475
|
'SCALAR' => sub { $_[1] }, |
108
|
1
|
|
|
|
|
509
|
'ARRAY' => sub { $_[1] }, |
109
|
1
|
|
|
|
|
471
|
'HASH' => sub { $_[1] }, |
110
|
|
|
|
|
|
|
}, |
111
|
|
|
|
|
|
|
'HASH' => { |
112
|
1
|
|
|
|
|
465
|
'SCALAR' => sub { $_[1] }, |
113
|
1
|
|
|
|
|
505
|
'ARRAY' => sub { $_[1] }, |
114
|
1
|
|
|
|
|
463
|
'HASH' => sub { $_[1] }, |
115
|
|
|
|
|
|
|
}, |
116
|
8
|
|
|
8
|
|
44
|
}; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
1161
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my %INDEX = ( |
119
|
|
|
|
|
|
|
L_ADDITIVE => L_ADDITIVE, |
120
|
|
|
|
|
|
|
L_OVERRIDE => L_OVERRIDE, |
121
|
|
|
|
|
|
|
L_REPLACE => L_REPLACE, |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
R_ADDITIVE => R_ADDITIVE, |
124
|
|
|
|
|
|
|
R_OVERRIDE => R_OVERRIDE, |
125
|
|
|
|
|
|
|
R_REPLACE => R_REPLACE, |
126
|
|
|
|
|
|
|
); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub import { |
129
|
8
|
|
|
8
|
|
53
|
shift; # throw off package name |
130
|
|
|
|
|
|
|
|
131
|
8
|
100
|
|
|
|
42
|
for (@_ ? @_ : keys %INDEX) { |
132
|
43
|
100
|
|
|
|
1222
|
unless (exists $INDEX{$_}) { |
133
|
1
|
|
|
|
|
6
|
require Carp; |
134
|
1
|
|
|
|
|
234
|
Carp::croak "Unable to register $_ (no such behavior)"; |
135
|
|
|
|
|
|
|
} |
136
|
42
|
|
|
|
|
81
|
Hash::Merge::specify_behavior($INDEX{$_}, $_); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |