File Coverage

blib/lib/URI/Find/Schemeless/Stricter.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             package URI::Find::Schemeless::Stricter;
2              
3 1     1   994 use 5.00600;
  1         4  
  1         43  
4              
5 1     1   6 use strict;
  1         1  
  1         40  
6              
7 1     1   16 use base 'URI::Find';
  1         10  
  1         1218  
8              
9             our $VERSION = '1.03';
10              
11             # We could put the whole ISO country code thing in here...
12             my $tldRe = '(?i:biz|com|edu|gov|info|int|mil|net|org|[a-z]{2})';
13             my $hostRe = '(?i:www|ftp|web)';
14             my $dottedquad = qr/(?:\d{1,3}\.){3}\d{1,3}/;
15             my $dnsSet = 'A-Za-z0-9-';
16             my $cruftSet = q{),.'";\]};
17             my $uricSet = __PACKAGE__->uric_set;
18              
19             sub _is_uri {
20 3     3   25718 my ($class, $candidate) = @_;
21 3 100       51 return 0 if $$candidate =~ /^$dottedquad$/;
22 2         16 return $class->SUPER::_is_uri($candidate);
23             }
24              
25             sub schemeless_uri_re {
26 1     1 1 1206 return qr{
  1     6   13  
  1         16  
  6         15381  
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             (?
35             |$ # or end of line
36             (?
37             |/[$uricSet#]* # or slash and URI chars
38             )
39             }x;
40             }
41              
42             1;
43             __END__