Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / URI / IRI.pm
CommitLineData
3fea05b9 1package URI::IRI;
2
3# Experimental
4
5use strict;
6use URI ();
7
8use overload '""' => sub { shift->as_string };
9
10sub new {
11 my($class, $uri, $scheme) = @_;
12 utf8::upgrade($uri);
13 return bless {
14 uri => URI->new($uri, $scheme),
15 }, $class;
16}
17
18sub clone {
19 my $self = shift;
20 return bless {
21 uri => $self->{uri}->clone,
22 }, ref($self);
23}
24
25sub as_string {
26 my $self = shift;
27 return $self->{uri}->as_iri;
28}
29
30sub 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
42sub DESTROY {} # avoid AUTOLOADing it
43
441;