On Sun, Aug 14, 2011 at 3:21 AM, Gisle_Aas via RT <bug-URI@rt.cpan.org>wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=69035 >
>
> On Wed Jun 22 15:55:15 2011, fulko.hew@gmail.com wrote:
> > I thought I'd try to use URI.pm in my code, and when I tested it
> > with an example I saw in Wikipedia, it didn't work right.
> > Therefore I don't know if Wikipedia is incorrect, URI.pm has a
> > bug or URI.pm has a limitation.
> >
> > The URI I was testing against was from:
> >
> >
http://en.wikipedia.org/wiki/URI_scheme
> >
> > with the actual text of:
> >
> > foo://
> username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose
> >
> > So my test code was:
> >
> > perl -e 'use URI;
> > $u=URI-
> > >new("foo://
> username:password@example.com:8000/over/there/index.dtb?type=animal&name=narwhal#nose
> ");
> > print $u->host, "\n";'
>
> When I try this I see:
>
> Can't locate object method "host" via package "URI::_foreign" at -e line
> 3.
>
> and if I add -w to the options I see:
>
> Possible unintended interpolation of @example in string at -e line 2.
>
> Isn't the missing perl-level escape of \@ your problem?
>
Thanks for pointing out the missing escape, but that isn't the real problem.
Following your response, I did a little more testing...
It turns out that because the example used a schema of 'foo:', the URI.pm
did not 'know' how to decode this and therefore generated the
"can't locate method 'host'" error/warning. When I changed the schema
to something like 'http', it successfully finds the host() method and
returns
a correct value (...provided I escape the @).
Is this the expected behavior when there is an 'unknown' schema?
Does URI.pm only support 'known' schemas?
Thanks for your assistance.
Fulko
Show quoted text>
> > expecting to see 'example.com' emitted, but I see
> > 'username:password.com' instead.
> >
> > I also tried printing 'userinfo', but that also didn't decode
> > correctly.
>
>
>
>