Common/URI/RFC2806.pm

filter: Statementstmt 100% 66 / 66 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 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/RFC2396.pm ↑ Summary Common/URI/fax.pm »
1 package Regexp::Common::URI::RFC2806;
2  
3 71 ▶use Regexp::Common::URI::RFC1035 qw /$domain/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 71 ▶use Regexp::Common::URI::RFC2396 qw /$unreserved $escaped $hex/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 71 our $VERSION = '2024080801';
10  
11  
12 71 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 71 our @ISA = qw /Exporter/;
14  
15  
16 71 my %vars;
17  
18 71 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
19 71 $vars {low} = [qw /$dtmf_digit $wait_for_dial_tone $one_second_pause
20 $pause_character $visual_separator $phonedigit
21 $escaped_no_dquote $quoted_string $token_char
22 $token_chars/];
23 71 $vars {parts} = [qw /$future_extension/];
24 71 $vars {connect} = [qw /$provider_hostname $provider_tag $service_provider
25 $private_prefix $local_network_prefix
26 $global_network_prefix $network_prefix/];
27 71 $vars {phone} = [qw /$phone_context_ident $phone_context_tag
28 $area_specifier $post_dial $isdn_subaddress
29 $t33_subaddress $local_phone_number
30 $local_phone_number_no_future
31 $base_phone_number $global_phone_number
32 $global_phone_number_no_future $telephone_subscriber
33 $telephone_subscriber_no_future/];
34 71 $vars {fax} = [qw /$fax_local_phone $fax_local_phone_no_future
35 $fax_global_phone $fax_global_phone_no_future
36 $fax_subscriber $fax_subscriber_no_future/];
37 71 $vars {modem} = [qw //];
38 }
39  
40  
41 71 our @EXPORT = ();
42 71 our @EXPORT_OK = map {@$_} values %vars;
43 71 our %EXPORT_TAGS = (%vars, ALL => [@EXPORT_OK]);
44  
45  
46 # RFC 2806, URIs for tel, fax & modem.
47 71 our $dtmf_digit = "(?:[*#ABCD])";
48 71 our $wait_for_dial_tone= "(?:w)";
49 71 our $one_second_pause = "(?:p)";
50 71 our $pause_character = "(?:[wp])"; # wait_for_dial_tone | one_second_pause.
51 71 our $visual_separator = "(?:[\\-.()])";
52 71 our $phonedigit = "(?:[0-9\\-.()])"; # DIGIT | visual_separator
53 71 our $escaped_no_dquote = "(?:%(?:[01]$hex)|2[013-9A-Fa-f]|[3-9A-Fa-f]$hex)";
54 71 our $quoted_string = "(?:%22(?:(?:%5C(?:$unreserved|$escaped))|" .
55 "$unreserved+|$escaped_no_dquote)*%22)";
56 # It is unclear wether we can allow only unreserved
57 # characters to unescaped, or can we also use uric
58 # characters that are unescaped? Or pchars?
59 71 our $token_char = "(?:[!'*\\-.0-9A-Z_a-z~]|" .
60 "%(?:2[13-7ABDEabde]|3[0-9]|4[1-9A-Fa-f]|" .
61 "5[AEFaef]|6[0-9A-Fa-f]|7[0-9ACEace]))";
62 # Only allowing unreserved chars to be unescaped.
63 71 our $token_chars = "(?:(?:[!'*\\-.0-9A-Z_a-z~]+|" .
64 "%(?:2[13-7ABDEabde]|3[0-9]|4[1-9A-Fa-f]|" .
65 "5[AEFaef]|6[0-9A-Fa-f]|7[0-9ACEace]))*)";
66 71 our $future_extension = "(?:;$token_chars" .
67 "(?:=(?:(?:$token_chars(?:[?]$token_chars)?)|" .
68 "$quoted_string))?)";
69 71 our $provider_hostname = $domain;
70 71 our $provider_tag = "(?:tsp)";
71 71 our $service_provider = "(?:;$provider_tag=$provider_hostname)";
72 71 our $private_prefix = "(?:(?:[!'E-OQ-VX-Z_e-oq-vx-z~]|" .
73 "(?:%(?:2[124-7CFcf]|3[AC-Fac-f]|4[05-9A-Fa-f]|" .
74 "5[1-689A-Fa-f]|6[05-9A-Fa-f]|" .
75 "7[1-689A-Ea-e])))" .
76 "(?:[!'()*\\-.0-9A-Z_a-z~]+|" .
77 "(?:%(?:2[1-9A-Fa-f]|3[AC-Fac-f]|" .
78 "[4-6][0-9A-Fa-f]|7[0-9A-Ea-e])))*)";
79 71 our $local_network_prefix
80 = "(?:[0-9\\-.()*#ABCDwp]+)";
81 71 our $global_network_prefix
82 = "(?:[+][0-9\\-.()]+)";
83 71 our $network_prefix = "(?:$global_network_prefix|$local_network_prefix)";
84 71 our $phone_context_ident
85 = "(?:$network_prefix|$private_prefix)";
86 71 our $phone_context_tag = "(?:phone-context)";
87 71 our $area_specifier = "(?:;$phone_context_tag=$phone_context_ident)";
88 71 our $post_dial = "(?:;postd=[0-9\\-.()*#ABCDwp]+)";
89 71 our $isdn_subaddress = "(?:;isub=[0-9\\-.()]+)";
90 71 our $t33_subaddress = "(?:;tsub=[0-9\\-.()]+)";
91  
92 71 our $local_phone_number= "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
93 "$post_dial?$area_specifier" .
94 "(?:$area_specifier|$service_provider|" .
95 "$future_extension)*)";
96 71 our $local_phone_number_no_future
97 = "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
98 "$post_dial?$area_specifier" .
99 "(?:$area_specifier|$service_provider)*)";
100 71 our $fax_local_phone = "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
101 "$t33_subaddress?$post_dial?$area_specifier" .
102 "(?:$area_specifier|$service_provider|" .
103 "$future_extension)*)";
104 71 our $fax_local_phone_no_future
105 = "(?:[0-9\\-.()*#ABCDwp]+$isdn_subaddress?" .
106 "$t33_subaddress?$post_dial?$area_specifier" .
107 "(?:$area_specifier|$service_provider)*)";
108 71 our $base_phone_number = "(?:[0-9\\-.()]+)";
109 71 our $global_phone_number
110 = "(?:[+]$base_phone_number$isdn_subaddress?" .
111 "$post_dial?" .
112 "(?:$area_specifier|$service_provider|" .
113 "$future_extension)*)";
114 71 our $global_phone_number_no_future
115 = "(?:[+]$base_phone_number$isdn_subaddress?" .
116 "$post_dial?" .
117 "(?:$area_specifier|$service_provider)*)";
118 71 our $fax_global_phone = "(?:[+]$base_phone_number$isdn_subaddress?" .
119 "$t33_subaddress?$post_dial?" .
120 "(?:$area_specifier|$service_provider|" .
121 "$future_extension)*)";
122 71 our $fax_global_phone_no_future
123 = "(?:[+]$base_phone_number$isdn_subaddress?" .
124 "$t33_subaddress?$post_dial?" .
125 "(?:$area_specifier|$service_provider)*)";
126 71 our $telephone_subscriber
127 = "(?:$global_phone_number|$local_phone_number)";
128 71 our $telephone_subscriber_no_future
129 = "(?:$global_phone_number_no_future|" .
130 "$local_phone_number_no_future)";
131 71 our $fax_subscriber = "(?:$fax_global_phone|$fax_local_phone)";
132 71 our $fax_subscriber_no_future
133 = "(?:$fax_global_phone_no_future|" .
134 "$fax_local_phone_no_future)";
135  
136 71 1;
137  
138 __END__
« Common/URI/RFC2396.pm ↑ Summary Common/URI/fax.pm »