Re: lwp-request -H 'HTTP-Header: value', plus LWP::Simple

Gisle Aas (gisle@aas.no)
21 Mar 1999 23:19:19 +0100


Ed <ed@chronos.net> writes:

> Below is a patch to lwp-request, the POD snippet says:
> +    -H <header>   send this HTTP header (you can specify several)
> This change means that now lwp-request uses Getopt::Long, so it
> uses $options{d} and not $opt_d.

Looks good. Applied.

> 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:
>     {
> 	cgi_var_name => $value,
> 	cgi_var_name2 => [ $value1, $value2 ],
>     }
> I mention get(), because with the second parameter specified, users
> wouldn't need to write their own CGI-encoding functions. The second
> parameter hash would be URL-encoded up and sent, in the obvious way.

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.

> 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.

Regards,
Gisle