line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Reg; |
2
|
2
|
|
|
2
|
|
24562
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
4
|
2
|
|
|
2
|
|
12
|
use Exporter 'import'; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
61
|
|
5
|
|
|
|
|
|
|
# Import re, but without warnings about empty list |
6
|
2
|
|
|
2
|
|
11
|
use re (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
884
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.2.5'; |
9
|
|
|
|
|
|
|
our @EXPORT = our @EXPORT_OK = 'reg'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub reg { |
12
|
0
|
|
|
0
|
1
|
|
my ($string, $pattern, %options) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# works like use, but it isn't done at compile time |
15
|
0
|
0
|
|
|
|
|
re->import('eval', $options{color} ? 'debugcolor' : 'debug'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Check if multiple matches are requested |
18
|
0
|
0
|
|
|
|
|
if ($options{global}) { |
19
|
|
|
|
|
|
|
# Saved in variable, so it wouldn't depend on wantarray() |
20
|
0
|
|
|
|
|
|
my @output = $string =~ /$pattern/g; |
21
|
0
|
|
|
|
|
|
return @output; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
0
|
|
|
|
|
|
return $string =~ /$pattern/; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Return positive value |
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |