Re: lwp-request -H 'HTTP-Header: value', plus LWP::Simple
Gisle Aas (gisle@aas.no)
22 Mar 1999 15:23:13 +0100
Ed <ed@chronos.net> writes:
> 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.
What I am saying is that I think that it is better to have no interface
than the wrong one. Especially when what you want to do is possible
other ways.
How do your post() interface work for mailto:-URIs or when you in the
future want to post something else than application/x-www-form-urlencoded
content? What should the return value be?
> For the second point, I didn't see a response above, and would like
> your reaction.
This is not consistent with the interface of
&HTTP::Request::Common::GET provide. Should it be?
> > > 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.
Why give cookies special support? Why not other headers? Is this
still going to be "Simple"?
Regards,
Gisle