Re: lwp-request -H 'HTTP-Header: value', plus LWP::Simple
Ed (ed@chronos.net)
Tue, 23 Mar 1999 10:12:10 +0000 (WET)
On 22 Mar 1999, Gisle Aas wrote:
> > 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.
I understand your concerns for preserving the right amount of
generality. In this case, doing GET is possible other ways, but
it's user-friendly to allow a (LWP::)simple way to do it. I have
in the past wanted an equally simple way to post, and was surprised
that it wasn't possible. My understanding is that we should make
simple things simple, because more complex things are already
possible.
> How do your post() interface work for mailto:-URIs
[...]
> What should the return value be?
It should return undef, the same as L::S::get('mailto:*') does.
> or when you in the
> future want to post something else than application/x-www-form-urlencoded
> content?
Well, that's more complex, so one would use the more complex interface.
> > * An optional second parameter to get(), which would protect users
> > from having to write CGI-var encoding routines themselves or figure
> > out URI::URL.
> This is not consistent with the interface of
> &HTTP::Request::Common::GET provide. Should it be?
Actually, it looks a lot like the interface that H::R::C::POST has.
I think GET should gain that capability, and so should LWP::Simple::*.
What do you think?
> > 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"?
The LWP library as it stands provides outstanding support for
getting simple content, including the L::S interface. As it stands,
it's more complex to make even a simple query to an "interactive"
page. Interactivity is usually done through the query, the cookies,
or both. That's why I'm proposing that these two things be accessible
in the L::S interface. I am aware that this may look like feature
creep, so I understand your wariness.
--
Ed | | mailto:ed@chronos.net
Chronos.Net | http://www.chronos.net/ | mailto:info@chronos.net