| 1 | package ctflags::check; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | require Exporter; | |||||||||||||||||||||||||||
| 10 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # this package is supposed to be private to ctflags and companion | ||||||||||||||||||||||||||||
| 13 | # packages, not used from any other module so it uses directly | ||||||||||||||||||||||||||||
| 14 | # @EXPORT. | ||||||||||||||||||||||||||||
| 15 | 1 | our @EXPORT = qw( chack_identifier | |||||||||||||||||||||||||||
| 16 | check_ns | ||||||||||||||||||||||||||||
| 17 | check_flag | ||||||||||||||||||||||||||||
| 18 | check_value | ||||||||||||||||||||||||||||
| 19 | check_flagset | ||||||||||||||||||||||||||||
| 20 | check_flagsetext | ||||||||||||||||||||||||||||
| 21 | check_alias | ||||||||||||||||||||||||||||
| 22 | check_defopt | ||||||||||||||||||||||||||||
| 23 | check_envname | ||||||||||||||||||||||||||||
| 24 | check_cntprefix | ||||||||||||||||||||||||||||
| 25 | check_package | ||||||||||||||||||||||||||||
| 26 | check_sub | ||||||||||||||||||||||||||||
| 27 | $identifier_re | ||||||||||||||||||||||||||||
| 28 | $ns_re | ||||||||||||||||||||||||||||
| 29 | $flag_re | ||||||||||||||||||||||||||||
| 30 | $value_re | ||||||||||||||||||||||||||||
| 31 | $flagset_re | ||||||||||||||||||||||||||||
| 32 | $flagsetext_re | ||||||||||||||||||||||||||||
| 33 | $alias_re | ||||||||||||||||||||||||||||
| 34 | $envname_re | ||||||||||||||||||||||||||||
| 35 | $cntprefix_re | ||||||||||||||||||||||||||||
| 36 | $package_re | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub myquote ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
myquote: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 0 | my $v=shift; | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | defined $v ? "'$v'" : "'undef'"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 1 | our $identifier_re = qr|[a-zA-Z_]\w*|; | |||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub check_identifier ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_identifier: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | (defined $_[0] and $_[0]=~/^$identifier_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and $_[0] =~ /^$ctflags::check::identifier_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::identifier_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::identifier_re$/o
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::identifier_re$/o
| |||||||||||||||||||||||||||||
| 49 | or die "invalid perl identifier ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 1 | our $ns_re=qr|$identifier_re(?::$identifier_re)*|; | |||||||||||||||||||||||||||
| 53 | 27 | ▶ | sub check_ns ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_ns: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 54 | 27 | ▶ | (defined $_[0] and $_[0]=~/^$ns_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_[0] and $_[0] =~ /^$ctflags::check::ns_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::ns_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::ns_re$/o
Truth table33%1/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::ns_re$/o
| |||||||||||||||||||||||||||||
| 55 | or die "invalid namespace specification ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 1 | our $flag_re=qr|[a-zA-Z]|; | |||||||||||||||||||||||||||
| 59 | 27 | ▶ | sub check_flag ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_flag: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 60 | 27 | ▶ | (defined $_[0] and $_[0]=~/^$flag_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_[0] and $_[0] =~ /^$ctflags::check::flag_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::flag_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::flag_re$/o
Truth table33%1/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::flag_re$/o
| |||||||||||||||||||||||||||||
| 61 | or die "invalid ctflag specification ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | our $value_re=qr|\d+|; | |||||||||||||||||||||||||||
| 65 | 21 | ▶ | sub check_value ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_value: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 21 | ▶ | (!defined $_[0] or $_[0]=~/^$value_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $_[0] or $_[0] =~ /^$ctflags::check::value_re$/o
MC/DC0%0/2
not defined $_[0] or $_[0] =~ /^$ctflags::check::value_re$/o
not defined $_[0]
$_[0] =~ /^$ctflags::check::value_re$/o
Truth table66%2/3
not(A) or B
A= not defined $_[0]B= $_[0] =~ /^$ctflags::check::value_re$/o
| |||||||||||||||||||||||||||||
| 67 | or die "invalid ctflag value ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 1 | our $flagset_re=qr|(?:$flag_re)*|; | |||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub check_flagset ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_flagset: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | (defined $_[0] and $_[0]=~/^$flagset_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and $_[0] =~ /^$ctflags::check::flagset_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::flagset_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::flagset_re$/o
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::flagset_re$/o
| |||||||||||||||||||||||||||||
| 73 | or die "invalid ctflags set ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 1 | our $flagsetext_re=qr{\*|!?$flagset_re}; | |||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub check_flagsetext ($) { | ||||||||||||||||||||||||||
|
Subroutine
check_flagsetext: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | (defined $_[0] and $_[0]=~/^$flagsetext_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and $_[0] =~ /^$ctflags::check::flagsetext_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::flagsetext_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::flagsetext_re$/o
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::flagsetext_re$/o
| |||||||||||||||||||||||||||||
| 79 | or die "invalid ctflags set ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 1 | our $alias_re=$identifier_re; | |||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub check_alias($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_alias: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | (defined $_[0] and $_[0]=~/^$identifier_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and $_[0] =~ /^$ctflags::check::identifier_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::identifier_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::identifier_re$/o
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::identifier_re$/o
| |||||||||||||||||||||||||||||
| 85 | or die "invalid alias specification ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub check_defopt($$) { | ||||||||||||||||||||||||||
|
Subroutine
check_defopt: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | defined $_[0] | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | or die "'undef' is not a valid value for option '$_[1]'\n"; | ||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 1 | our $envname_re=$identifier_re; | |||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub check_envname($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_envname: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | (defined $_[0] and $_[0]=~/^$envname_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and $_[0] =~ /^$ctflags::check::envname_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::envname_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::envname_re$/o
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::envname_re$/o
| |||||||||||||||||||||||||||||
| 96 | or die "invalid environment variable name ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 1 | our $cntprefix_re=qr/(?:$identifier_re)?/; | |||||||||||||||||||||||||||
| 100 | 1 | ▶ | sub check_cntprefix ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_cntprefix: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 101 | 1 | ▶ | (defined $_[0] and $_[0]=~/^$cntprefix_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_[0] and $_[0] =~ /^$ctflags::check::cntprefix_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::cntprefix_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::cntprefix_re$/o
Truth table33%1/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::cntprefix_re$/o
| |||||||||||||||||||||||||||||
| 102 | or die "invalid constant prefix ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 1 | our $package_re=qr|$identifier_re(?:::$identifier_re)*|; | |||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub check_package ($ ) { | ||||||||||||||||||||||||||
|
Subroutine
check_package: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | (defined $_[0] and $_[0]=~/^$package_re$/o) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and $_[0] =~ /^$ctflags::check::package_re$/o
MC/DC0%0/2
defined $_[0] and $_[0] =~ /^$ctflags::check::package_re$/o
defined $_[0]
$_[0] =~ /^$ctflags::check::package_re$/o
Truth table0%0/3
A and B
A= defined $_[0]B= $_[0] =~ /^$ctflags::check::package_re$/o
| |||||||||||||||||||||||||||||
| 108 | or die "invalid package name ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub check_sub ($) { | ||||||||||||||||||||||||||
|
Subroutine
check_sub: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | (defined $_[0] and UNIVERSAL::isa($_[0], 'CODE')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and UNIVERSAL::isa($_[0], "CODE")
MC/DC0%0/2
defined $_[0] and UNIVERSAL::isa($_[0], "CODE")
defined $_[0]
UNIVERSAL::isa($_[0], "CODE")
Truth table0%0/3
A and B
A= defined $_[0]B= UNIVERSAL::isa($_[0], "CODE")
| |||||||||||||||||||||||||||||
| 113 | or die "invalid sub ".myquote($_[0])."\n"; | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 1 | 1; | |||||||||||||||||||||||||||
| 117 | __END__ | ||||||||||||||||||||||||||||