Re: lwp-request -H 'HTTP-Header: value', plus LWP::Simple
Ed (ed@chronos.net)
Mon, 22 Mar 1999 12:01:33 +0000 (WET)
On 21 Mar 1999, Gisle Aas wrote:
> Ed <ed@chronos.net> writes:
> > I also propose an addition to LWP::Simple::get, and a new function,
> > L::S::post. They will both take a second parameter (optional for
> > get), which will be a hash-ref. This hash-ref is like so:
[...]
> I don't think I like this suggestion. A post() function similar to
> LWP::Simple::get() which forget most stuff in the response (like
> response code) is not the right thing. I rather prefer that people
> use the full OO interface for this. The reason I never added a post()
> function to LWP::Simple is that I never found any interface that I was
> happy with.
There are two points to be addressed here:
* LWP::Simple::post
* An optional second parameter to get(), which would protect users
from having to write CGI-var encoding routines themselves or figure
out URI::URL.
I understand that you have no use for a post() function, but by
excluding it from the interface, you're also dictating that no-one
else can have it either. I don't yet see from the above why a simple
get() function is good, and a post() function would be bad, and
would appreciate more input.
For the second point, I didn't see a response above, and would like
your reaction.
> > Finally, after discussing this with Gisle, I'd like to hide the
> > nastiness of cookies. This, as he suggested, would be an optional
> > third hash-ref argument to either get() or post(), in a similar
> > spirit to the above.
> Remind me.
The proposed usage:
get(
'http://server/t.cgi',
{ cgi_var => 'cgi_val' },
{ cookie_name => 'value' },
);
In this way, the user can write idiomatically, without having to
read the docs for many twisty Cookie modules.
--
Ed | | mailto:ed@chronos.net
Chronos.Net | http://www.chronos.net/ | mailto:info@chronos.net