On Tue, 2002-09-03 at 18:43, Gisle Aas wrote:

> > How about an option to someway tell query_param to use (if not default
> > to) ";" as the separator in query strings instead of "&"?
> 
> I actually thought a bit about that when I did URI::QueryParam, but I
> did not manage to come up with an API that I liked.  So I just ignored
> it in the end.

D'oh :)

> Some have suggested that $u->query_form should just split on both
> [&;].  I have two problems with that; 1) I'm not totally convinced
> that URIs like ?foo=1;2;3&bar=1 does not exist and

Hmm.  I wonder if anything that accepts both of delimiters works too
well with them mixed.  One way could be to use some heuristics like this
(probably needs work, kind of hacky):

    my $schar = ($qstring =~ /&[^;]+?=/) ? '&' : ';';

> 2) how do we know
> what to use for joining parameters.

How about using a instance variable in URI, something like this:

   $u = URI->new("", "http");

   $u->query_param(foo => 1, 2, 3);

   $u->query_sepchar('&');   # '&' is the default
   print $u->query;          # prints foo=1&foo=2&foo=3

   $u->query_sepchar(';');
   print $u->query;          # prints foo=1;foo=2;foo=3

....and if anything !~ /^[;&]$/ would be passed to query_sepchar, it
would carp() and revert to '&'.

-- 
\/ille Skytt�
ville.skytta at iki.fi

Reply via email to