Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Subclassing WWW::Mechanize

by LTjake (Prior)
on Nov 14, 2003 at 20:25 UTC ( [id://307198]=note: print w/replies, xml ) Need Help??


in reply to Subclassing WWW::Mechanize

Here's my quick fix:

sub _make_request { my ($self,$request,@rest) = @_; # fake a proxy $self->proxy( [ undef ] ); my $uri = $request->uri->as_string; my $response_content = "foobar\n"; # we'll probably have to build in support for redirects at some po +int my $response = HTTP::Response->new( defined $response_content ? RC_OK : RC_NOT_FOUND, ); $response->request($request); $response->push_header('Content-Type', 'text/html'); $response->content($response_content); return $response; }

It's a hack i know, but it gives me this output (with some added debug code (LWP::Debug))

LWP::UserAgent::new: () LWP::UserAgent::proxy: ARRAY(0x1ccb53c) LWP::UserAgent::proxy: undef LWP::UserAgent::proxy: foobar LWP::UserAgent::proxy: ARRAY(0x1da22b4) LWP::UserAgent::proxy: undef LWP::UserAgent::proxy: foobar

--
"To err is human, but to really foul things up you need a computer." --Paul Ehrlich

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://307198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-29 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found