Common/URI/RFC2396.pm

filter: Statementstmt 100% 67 / 67 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 72 / 72 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Common/URI/RFC2384.pm ↑ Summary Common/URI/RFC2806.pm »
1 package Regexp::Common::URI::RFC2396;
2  
3 71 ▶use Regexp::Common qw /pattern clean no_defaults/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 71 our $VERSION = '2024080801';
9  
10 71 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 71 our @ISA = qw /Exporter/;
12  
13  
14 71 my %vars;
15  
16 71 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
17 71 $vars {low} = [qw /$digit $upalpha $lowalpha $alpha $alphanum $hex
18 $escaped $mark $unreserved $reserved $pchar $uric
19 $urics $userinfo $userinfo_no_colon $uric_no_slash/];
20 71 $vars {parts} = [qw /$query $fragment $param $segment $path_segments
21 $ftp_segments $rel_segment $abs_path $rel_path
22 $path/];
23 71 $vars {connect} = [qw /$port $IPv4address $toplabel $domainlabel $hostname
24 $host $hostport $server $reg_name $authority/];
25 71 $vars {URI} = [qw /$scheme $net_path $opaque_part $hier_part
26 $relativeURI $absoluteURI $URI_reference/];
27 }
28  
29 71 our @EXPORT = ();
30 71 our @EXPORT_OK = map {@$_} values %vars;
31 71 our %EXPORT_TAGS = (%vars, ALL => [@EXPORT_OK]);
32  
33 # RFC 2396, base definitions.
34 71 our $digit = '[0-9]';
35 71 our $upalpha = '[A-Z]';
36 71 our $lowalpha = '[a-z]';
37 71 our $alpha = '[a-zA-Z]'; # lowalpha | upalpha
38 71 our $alphanum = '[a-zA-Z0-9]'; # alpha | digit
39 71 our $hex = '[a-fA-F0-9]';
40 71 our $escaped = "(?:%$hex$hex)";
41 71 our $mark = "[\\-_.!~*'()]";
42 71 our $unreserved = "[a-zA-Z0-9\\-_.!~*'()]"; # alphanum | mark
43 # %61-%7A, %41-%5A, %30-%39
44 # a - z A - Z 0 - 9
45 # %21, %27, %28, %29, %2A, %2D, %2E, %5F, %7E
46 # ! ' ( ) * - . _ ~
47 71 our $reserved = "[;/?:@&=+\$,]";
48 71 our $pchar = "(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]|$escaped)";
49 # unreserved | escaped | [:@&=+$,]
50 71 our $uric = "(?:[;/?:\@&=+\$,a-zA-Z0-9\\-_.!~*'()]|$escaped)";
51 # reserved | unreserved | escaped
52 71 our $urics = "(?:(?:[;/?:\@&=+\$,a-zA-Z0-9\\-_.!~*'()]+|" .
53 "$escaped)*)";
54  
55 71 our $query = $urics;
56 71 our $fragment = $urics;
57 71 our $param = "(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|$escaped)*)";
58 71 our $segment = "(?:$param(?:;$param)*)";
59 71 our $path_segments = "(?:$segment(?:/$segment)*)";
60 71 our $ftp_segments = "(?:$param(?:/$param)*)"; # NOT from RFC 2396.
61 71 our $rel_segment = "(?:(?:[a-zA-Z0-9\\-_.!~*'();\@&=+\$,]*|$escaped)+)";
62 71 our $abs_path = "(?:/$path_segments)";
63 71 our $rel_path = "(?:$rel_segment(?:$abs_path)?)";
64 71 our $path = "(?:(?:$abs_path|$rel_path)?)";
65  
66 71 our $port = "(?:$digit*)";
67 71 our $IPv4address = "(?:$digit+[.]$digit+[.]$digit+[.]$digit+)";
68 71 our $toplabel = "(?:$alpha"."[-a-zA-Z0-9]*$alphanum|$alpha)";
69 71 our $domainlabel = "(?:(?:$alphanum"."[-a-zA-Z0-9]*)?$alphanum)";
70 71 our $hostname = "(?:(?:$domainlabel\[.])*$toplabel\[.]?)";
71 71 our $host = "(?:$hostname|$IPv4address)";
72 71 our $hostport = "(?:$host(?::$port)?)";
73  
74 71 our $userinfo = "(?:(?:[a-zA-Z0-9\\-_.!~*'();:&=+\$,]+|$escaped)*)";
75 71 our $userinfo_no_colon = "(?:(?:[a-zA-Z0-9\\-_.!~*'();&=+\$,]+|$escaped)*)";
76 71 our $server = "(?:(?:$userinfo\@)?$hostport)";
77  
78 71 our $reg_name = "(?:(?:[a-zA-Z0-9\\-_.!~*'()\$,;:\@&=+]*|$escaped)+)";
79 71 our $authority = "(?:$server|$reg_name)";
80  
81 71 our $scheme = "(?:$alpha"."[a-zA-Z0-9+\\-.]*)";
82  
83 71 our $net_path = "(?://$authority$abs_path?)";
84 71 our $uric_no_slash = "(?:[a-zA-Z0-9\\-_.!~*'();?:\@&=+\$,]|$escaped)";
85 71 our $opaque_part = "(?:$uric_no_slash$urics)";
86 71 our $hier_part = "(?:(?:$net_path|$abs_path)(?:[?]$query)?)";
87  
88 71 our $relativeURI = "(?:(?:$net_path|$abs_path|$rel_path)(?:[?]$query)?";
89 71 our $absoluteURI = "(?:$scheme:(?:$hier_part|$opaque_part))";
90 71 our $URI_reference = "(?:(?:$absoluteURI|$relativeURI)?(?:#$fragment)?)";
91  
92 71 1;
93  
94 __END__
« Common/URI/RFC2384.pm ↑ Summary Common/URI/RFC2806.pm »