<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package URI::IRI;

# Experimental

use strict;
use URI ();

use overload '""' =&gt; sub { shift-&gt;as_string };

sub new {
    my($class, $uri, $scheme) = @_;
    utf8::upgrade($uri);
    return bless {
	uri =&gt; URI-&gt;new($uri, $scheme),
    }, $class;
}

sub clone {
    my $self = shift;
    return bless {
	uri =&gt; $self-&gt;{uri}-&gt;clone,
    }, ref($self);
}

sub as_string {
    my $self = shift;
    return $self-&gt;{uri}-&gt;as_iri;
}

sub AUTOLOAD
{
    use vars qw($AUTOLOAD);
    my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2);

    # We create the function here so that it will not need to be
    # autoloaded the next time.
    no strict 'refs';
    *$method = sub { shift-&gt;{uri}-&gt;$method(@_) };
    goto &amp;$method;
}

sub DESTROY {}   # avoid AUTOLOADing it

1;
</pre></body></html>