Re: Suggestion for LWP:Useragent.pm

Randal L. Schwartz (merlyn@stonehenge.com)
22 May 1999 19:05:50 -0700


>>>>> "Lennart" == Lennart Svensson <lennart.svensson@ks.ericsson.se> writes:

Lennart> Is it possible to fix some method or something which inhibit
Lennart> the redirection for those error code

If I understand your request, you want a request to not be automatically
redirected, but rather return to *you* the 301 or 302, correct?

There's two ways, both documented.  One is alluded to in the code
you quoted:

Lennart> 	return $response unless $self->redirect_ok($referral);

So, subclass LWP::UserAgent to make a class where $self->redirect_ok
returns false instead of true.  This is documented.

The other is to use $user_agent->simple_request instead of
$user_agent->request. This is also documented.

So, read the documentation.  It's not handholding, but it does have
all the basics already in there.

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me