Skip Menu |

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 31273
Status: open
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

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



Subject: New-style URIs for query parameters
Recent versions of the CGI module default to 'new-style URIs' where query parameters are separated with ; instead of &. The URI module should have an option to do the same, even if it is not on by default. Arguably the bug is with CGI, that it should be using URI instead of its own code, but in either case an enhancement to URI is needed. From the perldoc: $uri->query_form( \%hash ) Sets and returns query components that use the applica- tion/x-www-form-urlencoded format. Key/value pairs are separated by "&", and the key is separated from the value by a "=" character. With this proposed feature it would say that key/value pairs are separated by "&", or by ";" if the newstyle_uris option is set.
From: gnuruandstuff [...] yahoo.co.uk
On Thu Dec 06 10:59:33 2007, EDAVIS wrote: Show quoted text
> > With this proposed feature it would say that key/value pairs are > separated by "&", or by ";" if the newstyle_uris option is set.
I have no real idea why this issue with URI.pm wasn't fixed years ago, say in 1997. There are a few issues however. Firstly, URI.pm returns a blessed scalar. Note this isn't the sort of blessed scalar that one finds in inside-out objects. It's just a blessed scalar which means that attributes that don't form part of the scalar itself. Therefore an attribute such as your proposed 'newstyle_uris' option aren't possible. To resolve that issue, you'd need either to turn the URI.pm objects into something like hashes or else into inside-out objects. Those solutions do raise other issues, however. My preferred solution would be to have a new method in URI::_query that implements the desired functionality, called, say, "query_form_newstyle". Better still, I'd rename the current query_form, query_form_oldstyle and have the the subroutine named query_form return new style queries. This solution is extremely simple and could be implemented whilst falling over. There might be some duplicate code, but that minor issue could also be resolved during the same fall, whilst bumping one's head at the end of the fall.
From: gnuruandstuff [...] yahoo.co.uk
Patch is attached. Note this patch ensures that all the tests pass. So: perl Makefile.PL make make test will pass. As suggested with this patch "query_form" automatically assumes that the separator is ';'. "query_form_oldstyle" is available for those who want queries generated with '&'. Regards

Message body not shown because it is not plain text.