Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / URI / IRI.pm
1 package URI::IRI;
2
3 # Experimental
4
5 use strict;
6 use URI ();
7
8 use overload '""' => sub { shift->as_string };
9
10 sub new {
11     my($class, $uri, $scheme) = @_;
12     utf8::upgrade($uri);
13     return bless {
14         uri => URI->new($uri, $scheme),
15     }, $class;
16 }
17
18 sub clone {
19     my $self = shift;
20     return bless {
21         uri => $self->{uri}->clone,
22     }, ref($self);
23 }
24
25 sub as_string {
26     my $self = shift;
27     return $self->{uri}->as_iri;
28 }
29
30 sub AUTOLOAD
31 {
32     use vars qw($AUTOLOAD);
33     my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2);
34
35     # We create the function here so that it will not need to be
36     # autoloaded the next time.
37     no strict 'refs';
38     *$method = sub { shift->{uri}->$method(@_) };
39     goto &$method;
40 }
41
42 sub DESTROY {}   # avoid AUTOLOADing it
43
44 1;