source: main/trunk/greenstone2/perllib/cpan/URI/IRI.pm@ 27174

Last change on this file since 27174 was 27174, checked in by davidb, 11 years ago

Perl modules from CPAN that are used in supporting activate.pl, but not part of the Perl core. Only PMs included.

File size: 769 bytes
Line 
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;
Note: See TracBrowser for help on using the repository browser.