Skip Menu |
 

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 53252
Status: rejected
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: jean [...] veronis.fr
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Missing // in canonical
When the scheme is set using the 'scheme' method, the 'canonical' method seems to skip the double slash :

Example :

    my $uri = URI->new('www.google.com');
    $uri->scheme('http');
    print $uri->canonical, "\n";

This prints

    http:www.google.com

instead of

    http://www.google.com

This looks like a bug, unless I misundestood the use of 'scheme', or something else.
Many thanks.
This isn't a bug. URI->new('www.google.com') creates a relative URL.  The string 'www.google.com' is treated as a path name -- not a host name even if it looks like one.  Addding a scheme to a relative URL gives the result you saw.

You can use the URI::Heuristic if you want to convert strings like 'www.google.com' to URLs.

From: jean [...] veronis.fr
Download (untitled) / with headers
text/plain 105b
Oh, I&nbsp;see ! That was tricky.<br /> <br /> Many thanks your the prompt response !<br /> <br /> <br />


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.