line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YATT::Lite::RegexpNames; |
2
|
20
|
|
|
20
|
|
4863
|
use strict; |
|
20
|
|
|
|
|
51
|
|
|
20
|
|
|
|
|
631
|
|
3
|
20
|
|
|
20
|
|
99
|
use warnings qw(FATAL all NONFATAL misc); |
|
20
|
|
|
|
|
42
|
|
|
20
|
|
|
|
|
907
|
|
4
|
|
|
|
|
|
|
|
5
|
20
|
|
|
20
|
|
109
|
use Exporter qw/import/; |
|
20
|
|
|
|
|
40
|
|
|
20
|
|
|
|
|
545
|
|
6
|
20
|
|
|
20
|
|
104
|
use YATT::Lite::Util qw/globref symtab/; |
|
20
|
|
|
|
|
42
|
|
|
20
|
|
|
|
|
7449
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#======================================== |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub wrap { |
11
|
460
|
|
|
460
|
0
|
1474
|
my ($re, $partial) = @_; |
12
|
460
|
100
|
|
|
|
2703
|
$partial ? $re : qq!^$re\\z!; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# $this->re_name returns ^\w+$ -- Total pattern, usually for user input. |
16
|
|
|
|
|
|
|
# $this->re_name(1) returns \w+ -- Partial pattern. |
17
|
|
|
|
|
|
|
|
18
|
459
|
|
|
459
|
0
|
2071
|
sub re_name { wrap(qr{\w+}, $_[1]) } |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
0
|
9
|
sub re_digit { wrap(qr{(?:[0-9]+)}, $_[1]) } |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
0
|
0
|
sub re_integer { wrap(qr{(?:0|[1-9]\d*)}, $_[1]) } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Mainly for untainting. |
25
|
0
|
|
|
0
|
0
|
0
|
sub re_any { wrap(qr{.*}s, $_[1]) } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# 'nonempty'-check should not complain about surrounding white spaces. |
28
|
0
|
|
|
0
|
0
|
0
|
sub re_nonempty { qr{\S.*}s } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# aliases |
31
|
|
|
|
|
|
|
*re_word = *re_name; *re_word = *re_name; |
32
|
|
|
|
|
|
|
*re_int = *re_integer; *re_int = *re_integer; |
33
|
|
|
|
|
|
|
*re_digits = *re_digit; *re_digits = *re_digit; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#======================================== |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->build_exports(\ our(@EXPORT, @EXPORT_OK)); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub build_exports { |
41
|
20
|
|
|
20
|
0
|
70
|
my ($pack, @vars) = @_; |
42
|
20
|
|
|
|
|
93
|
my $symtab = symtab($pack); |
43
|
20
|
|
|
|
|
93
|
foreach my $name (grep {/^re_/} keys %$symtab) { |
|
320
|
|
|
|
|
657
|
|
44
|
160
|
|
|
|
|
352
|
my $glob = $symtab->{$name}; |
45
|
160
|
50
|
|
|
|
228
|
next unless *{$glob}{CODE}; |
|
160
|
|
|
|
|
445
|
|
46
|
160
|
|
|
|
|
498
|
push @$_, $name for @vars; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |