rootcho has asked for the wisdom of the Perl Monks concerning the following question:

hi,

I'm trying to see what happens with the request. I do something like this :
sub WWW::Mechanize::_make_request { my($self) = shift; my $req = $self->SUPER::request(@_); print Dumper $req; return $req }

w/o big success. I also tried similar thing with LWP::UserAgent::prepare_request(), again no success.
Any other ideas ?

Replies are listed 'Best First'.
Re: Intercepting the HTTP::Request
by Krambambuli (Curate) on May 16, 2007 at 10:16 UTC
    If you're trying to re-define WWW::Mechanize's _make_request method, maybe
    ... package WWW::Mechanize; sub _make_request { my($self) = shift; my $req = $self->SUPER::request(@_); print Dumper $req; return $req } ...
    is what you want ? Another possible problem might be that you suppose that WWW::Mechanize's STDOUT (where Dumper would write to) is something that comes in handy to you. That isn't really granted ;)
      No, I tried this too, also didn't work.. But I've done what I want this way :
      http://perlmonks.org/?node_id=615669
      Even that I would liked to do it trough, this way it wouldn't involve using external module.
Re: Intercepting the HTTP::Request
by TOD (Friar) on May 16, 2007 at 05:18 UTC
    what are you trying to achieve? maybe there's another solution for your task.
    --------------------------------
    masses are the opiate for religion.