For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > February 2005 > URI::URL query vs equery









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author URI::URL query vs equery
Ilya Zakharevich

2005-02-01, 8:56 am

I'm testing a module using URI::URL, and it refuses to call query() on
the URL created by google (lines should be merged...):

http://groups-beta.google.com/group...rl/browse_threa
d/thread/3ee08b1ef5ae3c12/30a234783d298f2e?q=beg%2Fyour+%22loca
l($_)+works%22+group:*.perl.*+author:Larry+author:Wall&_done=%2
Fgroups%3Fas_q%3Dbeg%2Fyour%26as_epq%3Dl
ocal($_)+works%26as_oq%
3D%26as_eq%3D%26btnG%3DGoogle+Search+New
s%26as_ugroup%3D*.perl.
*%26as_usubject%3D%26as_uauthors%3DLarry
+Wall%26as_umsgid%3D%26
lr%3D%26as_drrb%3Dq%26as_qdr%3D%26as_min
d%3D29%26as_minm%3D3%26
as_miny%3D1981%26as_maxd%3D26%26as_maxm%
3D10%26as_maxy%3D2005%2
6num%3D50%26as_scoring%3Dr%26&_doneTitle=Back+to+Search&&d#30a2
34783d298f2e

The error message is

Form query contains escaped '=' or '&' (you must call equery)

Of course, equery() works; however, I would prefer to have the result
of query()... Can somebody explain the reason behind this madness?
How to avoid this?

Thanks,
Ilya
Gisle Aas

2005-02-01, 8:57 am

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> I'm testing a module using URI::URL, and it refuses to call query() on
> the URL created by google (lines should be merged...):
>
> http://groups-beta.google.com/group...rl/browse_threa
> d/thread/3ee08b1ef5ae3c12/30a234783d298f2e?q=beg%2Fyour+%22loca
> l($_)+works%22+group:*.perl.*+author:Larry+author:Wall&_done=%2
> Fgroups%3Fas_q%3Dbeg%2Fyour%26as_epq%3Dl
ocal($_)+works%26as_oq%
> 3D%26as_eq%3D%26btnG%3DGoogle+Search+New
s%26as_ugroup%3D*.perl.
> *%26as_usubject%3D%26as_uauthors%3DLarry
+Wall%26as_umsgid%3D%26
> lr%3D%26as_drrb%3Dq%26as_qdr%3D%26as_min
d%3D29%26as_minm%3D3%26
> as_miny%3D1981%26as_maxd%3D26%26as_maxm%
3D10%26as_maxy%3D2005%2
> 6num%3D50%26as_scoring%3Dr%26&_doneTitle=Back+to+Search&&d#30a2
> 34783d298f2e
>
> The error message is
>
> Form query contains escaped '=' or '&' (you must call equery)
>
> Of course, equery() works; however, I would prefer to have the result
> of query()... Can somebody explain the reason behind this madness?


Backwards compatiblity.

> How to avoid this?


Avoid URI::URL; use URI.pm instead.

--
Gisle Aas
Ilya Zakharevich

2005-02-03, 8:55 am

[A complimentary Cc of this posting was sent to
Gisle Aas
<gisle@activestate.com>], who wrote in article <87sm4g38m7.fsf@ask.g.aas.no>:
> Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
>
>
> Backwards compatiblity.


That would be good. But is the error message backward-compatible???

[color=darkred]
> Avoid URI::URL; use URI.pm instead.


How? AFAIU, it has no analogue of query()...

Thanks,
Ilya

P.S. I do not care if query() is lossy...
Gisle Aas

2005-02-03, 8:55 am

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> <gisle@activestate.com>], who wrote in article <87sm4g38m7.fsf@ask.g.aas.no>:
>
> That would be good. But is the error message backward-compatible???


Not really sure. I hope so. I don't have any old versions of
URI::URL laying around so I can't easily check.

>
>
> How? AFAIU, it has no analogue of query()...


I would think that query_form() would be the right method for decoding
this URL. The old query() is gone because I strongly believe it was a
bad interface.

> P.S. I do not care if query() is lossy...


Then you could use:

uri_unescape($u->query);

or if you really want to stay with $u as a URI::URL reference:

uri_unescape($u->equery);

--
Gisle Aas
Ilya Zakharevich

2005-02-03, 8:55 pm

[A complimentary Cc of this posting was sent to
Gisle Aas
<gisle@activestate.com>], who wrote in article <87lla5sv1p.fsf@ask.g.aas.no>:
[color=darkred]
[color=darkred]
[color=darkred]
> Not really sure. I hope so.


> The old query() is gone because I strongly believe it was a bad interface.
> Then you could use:
>
> uri_unescape($u->equery);


Can you please be more specific? This is is what $u->query() does if
it would not die() in the check above... Was there any reason for the
check, or was it just a pilot error? Apparently, google has no
problem with URL above...

(query_form() returns pairs; I'm not interested in pairs...)

Thanks,
Ilya

P.S. During last two years I sent some email to you, and do not
remember seeing answers. I know some bugs/problems in LWP, is
it possible to report them without subscribing to yet more
mailing lists? E.g., is the news server mirror back-propagated
into the mailing list?
Ilya Zakharevich

2005-02-10, 3:56 am

[A complimentary Cc of this posting was sent to
Gisle Aas
<gisle@activestate.com>], who wrote in article <87sm4g38m7.fsf@ask.g.aas.no>:
> Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
>
>
> Backwards compatiblity.


That would be good. But is the error message backward-compatible???

[color=darkred]
> Avoid URI::URL; use URI.pm instead.


How? AFAIU, it has no analogue of query()...

Thanks,
Ilya

P.S. I do not care if query() is lossy...
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com