File Coverage

blib/lib/URI/IRI.pm
Criterion Covered Total %
statement 24 27 88.8
branch n/a
condition n/a
subroutine 9 12 75.0
pod 0 3 0.0
total 33 42 78.5


line stmt bran cond sub pod time code
1             package URI::IRI;
2              
3             # Experimental
4              
5 1     1   408 use strict;
  1         1  
  1         27  
6 1     1   3 use warnings;
  1         1  
  1         51  
7 1     1   3 use URI ();
  1         1  
  1         26  
8              
9 1     1   2 use overload '""' => sub { shift->as_string };
  1     0   1  
  1         5  
  0         0  
10              
11             our $VERSION = '5.35';
12              
13             sub new {
14 1     1 0 3 my($class, $uri, $scheme) = @_;
15 1         4 utf8::upgrade($uri);
16 1         3 return bless {
17             uri => URI->new($uri, $scheme),
18             }, $class;
19             }
20              
21             sub clone {
22 0     0 0 0 my $self = shift;
23             return bless {
24             uri => $self->{uri}->clone,
25 0         0 }, ref($self);
26             }
27              
28             sub as_string {
29 1     1 0 4 my $self = shift;
30 1         20 return $self->{uri}->as_iri;
31             }
32              
33             our $AUTOLOAD;
34             sub AUTOLOAD
35             {
36 1     1   4 my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2);
37              
38             # We create the function here so that it will not need to be
39             # autoloaded the next time.
40 1     1   157 no strict 'refs';
  1         1  
  1         72  
41 1     1   6 *$method = sub { shift->{uri}->$method(@_) };
  1         18  
42 1         3 goto &$method;
43             }
44              
45       0     sub DESTROY {} # avoid AUTOLOADing it
46              
47             1;