The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

# Let's try to make our URL subclass { package MyURL; @ISA = URI::URL::implementor();

    sub _parse {
        my($self, $init) = @_;
        $self->URI::URL::_generic::_parse($init, qw(netloc path));
    }

    sub foo {
        my $self = shift;
        print ref($self)."->foo called for $self\n";
    }
}
# Let's say that it implements the 'x-a+b.c' scheme (alias 'x-foo')
URI::URL::implementor('x-a+b.c', 'MyURL');
URI::URL::implementor('x-foo', 'MyURL');

# Now we are ready to try our new URL scheme $url = new URI::URL 'x-a+b.c://foo/bar;a?b'; is($url->as_string, 'x-a+b.c://foo/bar;a?b', ref($url) . '->as_string'); is($url->path, '/bar;a?b', ref($url) . '->path'); $url->foo; $newurl = new URI::URL 'xxx', $url; $newurl->foo; $url = new URI::URL 'yyy', 'x-foo:'; $url->foo;

1 POD Error

The following errors were encountered while parsing the POD:

Around line 64:

Unknown directive: =comment