Common/URI/RFC1808.pm

filter: Statementstmt 93.6% 59 / 63 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 87.0% 67 / 77 CC 3 SCAR 8.1
CC
3
Cov
90%
BEGIN
4.4
__ANON__
2.0
BEGIN
1.0
CRAP 2.2
« Common/zip.pm ↑ Summary Common/comment.pm »
1 package Regexp::Common::URI::RFC1808;
2  
3 71 ▶BEGIN {
Subroutine BEGIN: called CC=3 SCAR=14.8
4 # This makes sure 'use warnings' doesn't bomb out on 5.005_*;
5 # warnings won't be enabled on those old versions though.
6 71 ▶ if ($] < 5.006 && !exists $INC {"warnings.pm"}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.006" and not exists $INC{"warnings.pm"}) 0 71 71
Condition33%1/3
$] < "5.006" and not exists $INC{"warnings.pm"}
!ll&&!rl&&r
7100
MC/DC0%0/2
$] < "5.006" and not exists $INC{"warnings.pm"}
$] < "5.006" not exists $INC{"warnings.pm"}
Truth table33%1/3
A and not(B)
A= $] < "5.006"B= not exists $INC{"warnings.pm"}
ABresult
0X0
100
111
7 0 $INC {"warnings.pm"} = 1;
8 71 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 0 ▶ *{"warnings::unimport"} = sub {0};
Subroutine __ANON__: not called CC=1 SCAR=6.9
10 }
11 }
12  
13 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 71 our $VERSION = '2024080801';
17  
18 71 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 71 our @ISA = qw /Exporter/;
20  
21  
22 71 my %vars;
23  
24 71 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
25 $vars {low} = [qw /$punctuation $reserved_range $reserved $national
26 $extra $safe $digit $digits $hialpha $lowalpha
27 $alpha $alphadigit $hex $escape $unreserved_range
28 $unreserved $uchar $uchars $pchar_range $pchar
29 $pchars/],
30  
31 71 $vars {parts} = [qw /$fragment $query $param $params $segment
32 $fsegment $path $net_loc $scheme $rel_path
33 $abs_path $net_path $relativeURL $generic_RL
34 $absoluteURL $URL/],
35 }
36  
37 71 our @EXPORT = qw /$host/;
38 71 our @EXPORT_OK = map {@$_} values %vars;
39 71 our %EXPORT_TAGS = (%vars, ALL => [@EXPORT_OK]);
40  
41 # RFC 1808, base definitions.
42  
43 # Lowlevel definitions.
44 71 our $punctuation = '[<>#%"]';
45 71 our $reserved_range = q [;/?:@&=];
46 71 our $reserved = "[$reserved_range]";
47 71 our $national = '[][{}|\\^~`]';
48 71 our $extra = "[!*'(),]";
49 71 our $safe = '[-$_.+]';
50  
51 71 our $digit = '[0-9]';
52 71 our $digits = '[0-9]+';
53 71 our $hialpha = '[A-Z]';
54 71 our $lowalpha = '[a-z]';
55 71 our $alpha = '[a-zA-Z]'; # lowalpha | hialpha
56 71 our $alphadigit = '[a-zA-Z0-9]'; # alpha | digit
57  
58 71 our $hex = '[a-fA-F0-9]';
59 71 our $escape = "(?:%$hex$hex)";
60  
61 71 our $unreserved_range = q [-a-zA-Z0-9$_.+!*'(),]; # alphadigit | safe | extra
62 71 our $unreserved = "[$unreserved_range]";
63 71 our $uchar = "(?:$unreserved|$escape)";
64 71 our $uchars = "(?:(?:$unreserved+|$escape)*)";
65  
66 71 our $pchar_range = qq [$unreserved_range:\@&=];
67 71 our $pchar = "(?:[$pchar_range]|$escape)";
68 71 our $pchars = "(?:(?:[$pchar_range]+|$escape)*)";
69  
70  
71 # Parts
72 71 our $fragment = "(?:(?:[$unreserved_range$reserved_range]+|" .
73 "$escape)*)";
74 71 our $query = "(?:(?:[$unreserved_range$reserved_range]+|" .
75 "$escape)*)";
76  
77 71 our $param = "(?:(?:[$pchar_range/]+|$escape)*)";
78 71 our $params = "(?:$param(?:;$param)*)";
79  
80 71 our $segment = "(?:(?:[$pchar_range]+|$escape)*)";
81 71 our $fsegment = "(?:(?:[$pchar_range]+|$escape)+)";
82 71 our $path = "(?:$fsegment(?:/$segment)*)";
83  
84 71 our $net_loc = "(?:(?:[$pchar_range;?]+|$escape)*)";
85 71 our $scheme = "(?:(?:[-a-zA-Z0-9+.]+|$escape)+)";
86  
87 71 our $rel_path = "(?:$path?(?:;$params)?(?:?$query)?)";
88 71 our $abs_path = "(?:/$rel_path)";
89 71 our $net_path = "(?://$net_loc$abs_path?)";
90  
91 71 our $relativeURL = "(?:$net_path|$abs_path|$rel_path)";
92 71 our $generic_RL = "(?:$scheme:$relativeURL)";
93 71 our $absoluteURL = "(?:$generic_RL|" .
94 "(?:$scheme:(?:[$unreserved_range$reserved_range]+|" .
95 "$escape)*))";
96 71 our $URL = "(?:(?:$absoluteURL|$relativeURL)(?:#$fragment)?)";
97  
98  
99 71 1;
100  
101 __END__
« Common/zip.pm ↑ Summary Common/comment.pm »