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   431 use strict;
  1         2  
  1         29  
6 1     1   5 use warnings;
  1         2  
  1         23  
7 1     1   14 use URI ();
  1         2  
  1         47  
8              
9 1     1   6 use overload '""' => sub { shift->as_string };
  1     0   2  
  1         15  
  0         0  
10              
11             our $VERSION = '5.20';
12              
13             sub new {
14 1     1 0 3 my($class, $uri, $scheme) = @_;
15 1         7 utf8::upgrade($uri);
16 1         6 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 7 my $self = shift;
30 1         28 return $self->{uri}->as_iri;
31             }
32              
33             our $AUTOLOAD;
34             sub AUTOLOAD
35             {
36 1     1   8 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   259 no strict 'refs';
  1         2  
  1         104  
41 1     1   8 *$method = sub { shift->{uri}->$method(@_) };
  1         25  
42 1         5 goto &$method;
43             }
44              
45       0     sub DESTROY {} # avoid AUTOLOADing it
46              
47             1;