in reply to Re: Clean way to build URI's?
in thread Clean way to build URI's?

Because it doesn't URL-encode characters in the interpolated strings, so the outcome is not guaranteed to be a syntactically valid URI.

Maybe the URI module would be more appropriate?

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^3: Clean way to build URI's?
by BrowserUk (Patriarch) on Feb 02, 2010 at 12:07 UTC

    I was asking why the OP thought so. Now we'll never know for sure.

    BTW:URL encoding is easily applied after the interpolation.

      BTW:URL encoding is easily applied after the interpolation.

      Not without possible data loss.

      my $value = 'foo&bar=baz'; my $key = 'something' my $url1 = encode_url("http://example.com/script?$value=$key"); my $url2 = 'http://example.com/script?%s=%s', map encode_url_chunk($_) +, $key, $value;

      For proper working functions encode_url and encode_url_chunk (which have to encode different things, of course) the outcome will be different.

      Perl 6 - links to (nearly) everything that is Perl 6.
      No it's not. The encoder would have no way to know which "?" (for example) are separators (can't be encoded) and which "?" are data (must be encoded).