line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::Merge::Extra; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
336159
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
238
|
|
4
|
8
|
|
|
8
|
|
38
|
use warnings FATAL => 'all'; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
270
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
595
|
use Hash::Merge qw(_merge_hashes); |
|
8
|
|
|
|
|
3788
|
|
|
8
|
|
|
|
|
1838
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; # Don't forget to change in pod below |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use constant L_ADDITIVE => { |
11
|
|
|
|
|
|
|
'SCALAR' => { |
12
|
3
|
100
|
|
|
|
2935
|
'SCALAR' => sub { defined $_[0] ? $_[0] : $_[1] }, |
13
|
2
|
100
|
|
|
|
1040
|
'ARRAY' => sub { defined $_[0] ? $_[0] : $_[1] }, |
14
|
2
|
100
|
|
|
|
1001
|
'HASH' => sub { defined $_[0] ? $_[0] : $_[1] }, |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
'ARRAY' => { |
17
|
1
|
|
|
|
|
484
|
'SCALAR' => sub { $_[0] }, |
18
|
1
|
|
|
|
|
469
|
'ARRAY' => sub { [ @{$_[0]}, @{$_[1]} ] }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
19
|
1
|
|
|
|
|
478
|
'HASH' => sub { $_[0] }, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
'HASH' => { |
22
|
1
|
|
|
|
|
461
|
'SCALAR' => sub { $_[0] }, |
23
|
1
|
|
|
|
|
461
|
'ARRAY' => sub { $_[0] }, |
24
|
1
|
|
|
|
|
461
|
'HASH' => sub { _merge_hashes(@_) }, |
25
|
|
|
|
|
|
|
}, |
26
|
8
|
|
|
8
|
|
53
|
}; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
1848
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use constant R_ADDITIVE => { |
29
|
|
|
|
|
|
|
'SCALAR' => { |
30
|
3
|
100
|
|
|
|
3352
|
'SCALAR' => sub { defined $_[1] ? $_[1] : $_[0] }, |
31
|
1
|
|
|
|
|
486
|
'ARRAY' => sub { $_[1] }, |
32
|
1
|
|
|
|
|
454
|
'HASH' => sub { $_[1] }, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
'ARRAY' => { |
35
|
2
|
100
|
|
|
|
1043
|
'SCALAR' => sub { defined $_[1] ? $_[1] : $_[0] }, |
36
|
1
|
|
|
|
|
514
|
'ARRAY' => sub { [ @{$_[1]}, @{$_[0]} ] }, |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
37
|
1
|
|
|
|
|
485
|
'HASH' => sub { $_[1] }, |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
'HASH' => { |
40
|
2
|
100
|
|
|
|
1123
|
'SCALAR' => sub { defined $_[1] ? $_[1] : $_[0] }, |
41
|
1
|
|
|
|
|
497
|
'ARRAY' => sub { $_[1] }, |
42
|
1
|
|
|
|
|
498
|
'HASH' => sub { _merge_hashes(@_) }, |
43
|
|
|
|
|
|
|
}, |
44
|
8
|
|
|
8
|
|
81
|
}; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
1297
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use constant L_OVERRIDE => { |
47
|
|
|
|
|
|
|
'SCALAR' => { |
48
|
2
|
|
|
|
|
2349
|
'SCALAR' => sub { $_[0] }, |
49
|
1
|
|
|
|
|
556
|
'ARRAY' => sub { $_[0] }, |
50
|
1
|
|
|
|
|
497
|
'HASH' => sub { $_[0] }, |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
'ARRAY' => { |
53
|
1
|
|
|
|
|
513
|
'SCALAR' => sub { $_[0] }, |
54
|
1
|
|
|
|
|
534
|
'ARRAY' => sub { $_[0] }, |
55
|
1
|
|
|
|
|
465
|
'HASH' => sub { $_[0] }, |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
'HASH' => { |
58
|
1
|
|
|
|
|
455
|
'SCALAR' => sub { $_[0] }, |
59
|
1
|
|
|
|
|
467
|
'ARRAY' => sub { $_[0] }, |
60
|
1
|
|
|
|
|
460
|
'HASH' => sub { _merge_hashes(@_) }, |
61
|
|
|
|
|
|
|
}, |
62
|
8
|
|
|
8
|
|
42
|
}; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
1273
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use constant R_OVERRIDE => { |
65
|
|
|
|
|
|
|
'SCALAR' => { |
66
|
2
|
|
|
|
|
2599
|
'SCALAR' => sub { $_[1] }, |
67
|
1
|
|
|
|
|
619
|
'ARRAY' => sub { $_[1] }, |
68
|
1
|
|
|
|
|
513
|
'HASH' => sub { $_[1] }, |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
'ARRAY' => { |
71
|
1
|
|
|
|
|
460
|
'SCALAR' => sub { $_[1] }, |
72
|
1
|
|
|
|
|
504
|
'ARRAY' => sub { $_[1] }, |
73
|
1
|
|
|
|
|
472
|
'HASH' => sub { $_[1] }, |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
'HASH' => { |
76
|
1
|
|
|
|
|
465
|
'SCALAR' => sub { $_[1] }, |
77
|
1
|
|
|
|
|
745
|
'ARRAY' => sub { $_[1] }, |
78
|
1
|
|
|
|
|
526
|
'HASH' => sub { _merge_hashes(@_) }, |
79
|
|
|
|
|
|
|
}, |
80
|
8
|
|
|
8
|
|
39
|
}; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
1395
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
use constant L_REPLACE => { |
83
|
|
|
|
|
|
|
'SCALAR' => { |
84
|
1
|
|
|
|
|
2488
|
'SCALAR' => sub { $_[0] }, |
85
|
1
|
|
|
|
|
676
|
'ARRAY' => sub { $_[0] }, |
86
|
1
|
|
|
|
|
579
|
'HASH' => sub { $_[0] }, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
'ARRAY' => { |
89
|
1
|
|
|
|
|
586
|
'SCALAR' => sub { $_[0] }, |
90
|
1
|
|
|
|
|
610
|
'ARRAY' => sub { $_[0] }, |
91
|
1
|
|
|
|
|
569
|
'HASH' => sub { $_[0] }, |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
'HASH' => { |
94
|
1
|
|
|
|
|
553
|
'SCALAR' => sub { $_[0] }, |
95
|
1
|
|
|
|
|
631
|
'ARRAY' => sub { $_[0] }, |
96
|
1
|
|
|
|
|
581
|
'HASH' => sub { $_[0] }, |
97
|
|
|
|
|
|
|
}, |
98
|
8
|
|
|
8
|
|
45
|
}; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
1413
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
use constant R_REPLACE => { |
101
|
|
|
|
|
|
|
'SCALAR' => { |
102
|
1
|
|
|
|
|
2391
|
'SCALAR' => sub { $_[1] }, |
103
|
1
|
|
|
|
|
574
|
'ARRAY' => sub { $_[1] }, |
104
|
1
|
|
|
|
|
478
|
'HASH' => sub { $_[1] }, |
105
|
|
|
|
|
|
|
}, |
106
|
|
|
|
|
|
|
'ARRAY' => { |
107
|
1
|
|
|
|
|
454
|
'SCALAR' => sub { $_[1] }, |
108
|
1
|
|
|
|
|
499
|
'ARRAY' => sub { $_[1] }, |
109
|
1
|
|
|
|
|
502
|
'HASH' => sub { $_[1] }, |
110
|
|
|
|
|
|
|
}, |
111
|
|
|
|
|
|
|
'HASH' => { |
112
|
1
|
|
|
|
|
485
|
'SCALAR' => sub { $_[1] }, |
113
|
1
|
|
|
|
|
492
|
'ARRAY' => sub { $_[1] }, |
114
|
1
|
|
|
|
|
505
|
'HASH' => sub { $_[1] }, |
115
|
|
|
|
|
|
|
}, |
116
|
8
|
|
|
8
|
|
43
|
}; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
1263
|
|
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
|
|
48
|
shift; # throw off package name |
130
|
|
|
|
|
|
|
|
131
|
8
|
100
|
|
|
|
40
|
for (@_ ? @_ : keys %INDEX) { |
132
|
43
|
100
|
|
|
|
1206
|
unless (exists $INDEX{$_}) { |
133
|
1
|
|
|
|
|
5
|
require Carp; |
134
|
1
|
|
|
|
|
141
|
Carp::croak "Unable to register $_ (no such behavior)"; |
135
|
|
|
|
|
|
|
} |
136
|
42
|
|
|
|
|
82
|
Hash::Merge::specify_behavior($INDEX{$_}, $_); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
__END__ |