blib/lib/YATT/Lite/RegexpNames.pm

filter: Statementstmt 91.4% 32 / 35 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod 0.0% 0 / 7 totaltotal 75.4% 43 / 57 CC 5 SCAR 7.6
CC
5
Cov
90%
build_exports
4.0
wrap
2.0
re_integer
2.0
CRAP 2.1
« blib/lib/YATT/Lite/Util/CycleDetector.pm ↑ Summary scripts/yatt.genperl »
1 package YATT::Lite::RegexpNames;
2 54 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 54 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 54 ▶use Exporter qw/import/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 54 ▶use YATT::Lite::Util qw/globref symtab/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #========================================
9  
10 943 ▶sub wrap {
Subroutine wrap: called CC=2 SCAR=6.9
Pod undocumented
11 943 my ($re, $partial) = @_;
12 943 ▶ $partial ? $re : qq!^$re\\z!;
Branch: 1 branch
BranchTrueFalseTotal
$partial ? : 1 942 943
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 942 ▶sub re_name { wrap(qr{\w+}, $_[1]) }
Subroutine re_name: called CC=1 SCAR=0.0
Pod undocumented
19  
20 1 ▶sub re_digit { wrap(qr{(?:[0-9]+)}, $_[1]) }
Subroutine re_digit: called CC=1 SCAR=0.0
Pod undocumented
21  
22 0 ▶sub re_integer { wrap(qr{(?:0|[1-9]\d*)}, $_[1]) }
Subroutine re_integer: not called CC=1 SCAR=6.9
Pod undocumented
23  
24 # Mainly for untainting.
25 0 ▶sub re_any { wrap(qr{.*}s, $_[1]) }
Subroutine re_any: not called CC=1 SCAR=6.9
Pod undocumented
26  
27 # 'nonempty'-check should not complain about surrounding white spaces.
28 0 ▶sub re_nonempty { qr{\S.*}s }
Subroutine re_nonempty: not called CC=1 SCAR=6.9
Pod undocumented
29  
30 # aliases
31 54 *re_word = *re_name; *re_word = *re_name;
32 54 *re_int = *re_integer; *re_int = *re_integer;
33 54 *re_digits = *re_digit; *re_digits = *re_digit;
34  
35  
36 #========================================
37  
38 54 __PACKAGE__->build_exports(\ our(@EXPORT, @EXPORT_OK));
39  
40 54 ▶sub build_exports {
Subroutine build_exports: called CC=4 SCAR=13.9
Pod undocumented
41 54 my ($pack, @vars) = @_;
42 54 my $symtab = symtab($pack);
43 54 foreach my $name (grep {/^re_/} keys %$symtab) {
44 432 my $glob = $symtab->{$name};
45 432 ▶ next unless *{$glob}{CODE};
Branch: 1 branch
BranchTrueFalseTotal
unless *{$glob;}{"CODE"} 0 432 432
46 432 push @$_, $name for @vars;
47 }
48 }
49  
50 54 1;
« blib/lib/YATT/Lite/Util/CycleDetector.pm ↑ Summary scripts/yatt.genperl »