line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::Utils; |
2
|
|
|
|
|
|
|
$Tangerine::Utils::VERSION = '0.20'; |
3
|
15
|
|
|
15
|
|
265
|
use 5.010; |
|
15
|
|
|
|
|
50
|
|
4
|
15
|
|
|
15
|
|
74
|
use strict; |
|
15
|
|
|
|
|
20
|
|
|
15
|
|
|
|
|
293
|
|
5
|
15
|
|
|
15
|
|
68
|
use warnings; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
380
|
|
6
|
15
|
|
|
15
|
|
10378
|
use version 0.77; |
|
15
|
|
|
|
|
30638
|
|
|
15
|
|
|
|
|
105
|
|
7
|
15
|
|
|
15
|
|
1121
|
use Exporter 'import'; |
|
15
|
|
|
|
|
62
|
|
|
15
|
|
|
|
|
7832
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw(accessor addoccurence stripquotelike $vre); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $vre = qr/^($version::LAX)$/o; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub accessor { |
13
|
|
|
|
|
|
|
# TODO: This needs checks |
14
|
2888
|
100
|
|
2888
|
1
|
18183
|
$_[1]->{$_[0]} = $_[2] ? $_[2] : $_[1]->{$_[0]} |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub stripquotelike { |
18
|
|
|
|
|
|
|
my @filtered = map { |
19
|
140
|
100
|
|
|
|
1009
|
if (/^(?:'|").*$/o) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
20
|
64
|
|
|
|
|
374
|
substr $_, 1, -1 |
21
|
|
|
|
|
|
|
} elsif (/^(?:\(|\[|\{).*$/so) { |
22
|
16
|
|
|
|
|
1257
|
stripquotelike(split /,|=>/so, substr $_, 1, -1) |
23
|
|
|
|
|
|
|
} elsif (/^qq?\s*[^\w](.*)[^\w]$/so) { |
24
|
5
|
|
|
|
|
53
|
$1 |
25
|
|
|
|
|
|
|
} elsif (/^qw\s*[^\w](.*)[^\w]$/so) { |
26
|
23
|
|
|
|
|
425
|
grep { $_ } split /\s+/so, $1 |
|
52
|
|
|
|
|
155
|
|
27
|
|
|
|
|
|
|
} else { |
28
|
32
|
|
|
|
|
347
|
$_ |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} grep { |
31
|
217
|
100
|
|
|
|
2047
|
1 if !/^(?:,|=>|;|)$/so |
32
|
|
|
|
|
|
|
} map { |
33
|
90
|
|
|
90
|
1
|
808
|
s/^\s+|\s+$//sgor |
|
217
|
|
|
|
|
1540
|
|
34
|
|
|
|
|
|
|
} @_; |
35
|
90
|
100
|
|
|
|
638
|
return wantarray ? @filtered : $filtered[0]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub addoccurence { |
39
|
178
|
|
|
178
|
1
|
273
|
my ($a, $b) = @_; |
40
|
178
|
|
|
|
|
381
|
for my $k (keys %$b) { |
41
|
157
|
100
|
|
|
|
330
|
if (exists $$a{$k}) { |
42
|
40
|
|
|
|
|
56
|
$a->{$k} = [ @{$a->{$k}}, $b->{$k} ]; |
|
40
|
|
|
|
|
191
|
|
43
|
|
|
|
|
|
|
} else { |
44
|
117
|
|
|
|
|
362
|
$a->{$k} = [ $b->{$k} ]; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
178
|
|
|
|
|
578
|
return $a; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |