line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Config::Mini::WithRegexp; |
2
|
1
|
|
|
1
|
|
1182
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01_01'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
13
|
use base 'Config::Mini'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
891
|
|
8
|
1
|
|
|
1
|
|
2044
|
use Scalar::Util qw(); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
217
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub regexp_prepare { |
11
|
1
|
|
|
1
|
0
|
11487
|
my Config::Mini $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
6
|
$self->{$_} = _regexp_prepare($self->{$_}) for keys %$self; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
5
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _regexp_prepare { |
19
|
8
|
|
|
8
|
|
12
|
my $token = shift; |
20
|
8
|
|
|
|
|
16
|
my $type = Scalar::Util::reftype($token); |
21
|
8
|
100
|
|
|
|
18
|
unless ($type) { |
22
|
4
|
50
|
|
|
|
14
|
unless ($token) { |
23
|
0
|
|
|
|
|
0
|
return $token; |
24
|
|
|
|
|
|
|
} else { |
25
|
4
|
|
|
|
|
5
|
my $cp = $token; |
26
|
4
|
100
|
66
|
|
|
24
|
if ($cp =~ s/^~\s*// and $cp) { |
27
|
2
|
|
|
|
|
146
|
$token = eval('qr'.$cp); |
28
|
|
|
|
|
|
|
} |
29
|
4
|
|
|
|
|
19
|
return $token; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} else { |
32
|
4
|
100
|
|
|
|
17
|
if (Scalar::Util::blessed($token)) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# don't touch created object |
34
|
1
|
|
|
|
|
4
|
return $token; |
35
|
|
|
|
|
|
|
} elsif ($type eq 'HASH') { |
36
|
1
|
|
|
|
|
6
|
$token->{$_} = _regexp_prepare($token->{$_}) for keys %$token; |
37
|
1
|
|
|
|
|
4
|
return $token; |
38
|
|
|
|
|
|
|
} elsif ($type eq 'ARRAY') { |
39
|
2
|
|
|
|
|
7
|
$_ = _regexp_prepare($_) for @$token; |
40
|
2
|
|
|
|
|
7
|
return $token; |
41
|
|
|
|
|
|
|
} else { |
42
|
0
|
|
|
|
|
|
return $token; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |