blib/lib/URI/Find/Schemeless/Stricter.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 28 / 28 CC 2 SCAR 2.9
CC
2
Cov
100%
_is_uri
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package URI::Find::Schemeless::Stricter;
2  
3 2 ▶use 5.00600;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use base 'URI::Find';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '1.03';
10  
11 # We could put the whole ISO country code thing in here...
12 2 my $tldRe = '(?i:biz|com|edu|gov|info|int|mil|net|org|[a-z]{2})';
13 2 my $hostRe = '(?i:www|ftp|web)';
14 2 my $dottedquad = qr/(?:\d{1,3}\.){3}\d{1,3}/;
15 2 my $dnsSet = 'A-Za-z0-9-';
16 2 my $cruftSet = q{),.'";\]};
17 2 my $uricSet = __PACKAGE__->uric_set;
18  
19 3 ▶sub _is_uri {
Subroutine _is_uri: called CC=2 SCAR=6.9
20 3 my ($class, $candidate) = @_;
21 3 ▶ return 0 if $$candidate =~ /^$dottedquad$/;
Branch: 1 branch
BranchTrueFalseTotal
if $$candidate =~ /^$dottedquad$/ 1 2 3
22 2 return $class->SUPER::_is_uri($candidate);
23 }
24  
25 6 ▶sub schemeless_uri_re {
Subroutine schemeless_uri_re: called CC=1 SCAR=0.0
Pod documented
26 6 return qr{
27 (?: ^ | (?<=[\s<]) )
28 # hostname
29 (?: $hostRe\.[$dnsSet]+(?:\.[$dnsSet]+)*\.$tldRe
30 | $dottedquad ) # not inet_aton() complete
31 (?:
32 (?=[\s>?$cruftSet]) # followed by unrelated thing
33 (?!\.\w) # but don't stop mid foo.xx.bar
34 (?<!\.p[ml]) # but exclude Foo.pm and Foo.pl
35 |$ # or end of line
36 (?<!\.p[ml]) # but exclude Foo.pm and Foo.pl
37 |/[$uricSet#]* # or slash and URI chars
38 )
39 }x;
40 }
41  
42 2 1;
43 __END__
↑ Summary