Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 1708
Status: resolved
Priority: 90/
Queue: WWW-Mechanize

People
Owner: andy [...] petdance.com
Requestors: andy [...] petdance.com
Cc: Philippe.Bruhat [...] free.fr
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Replace _do_request
Cc: Philippe.Bruhat [...] free.fr
From: Philippe 'BooK' Bruhat <Philippe.Bruhat@free.fr> To: andy@petdance.com Subject: Problem with WWW::Mechanize test suite In fact, if I understand LWP::UserAgent correctly, a WWW::Mechanize object probably needs to do away with the _do_request() method, and simply overload the send_request() method from LWP::UserAgent: sub send_request { my $self = shift; my $request = shift; foreach my $h ( keys %WWW::Mechanize::headers ) { $request->header( $h => $WWW::Mechanize::headers{$h} ); } $self->{res} = $self->SUPER::send_request( $request, @_ ); $self->{status} = $self->{res}->code; $self->{base} = $self->{res}->base; $self->{ct} = $self->{res}->content_type || ""; $self->{content} = $self->{res}->content; if ( $self->{ct} eq 'text/html' ) { $self->{forms} = [ HTML::Form->parse( $self->{content}, $self->{res}->base ) ]; $self->{form} = $self->{forms}->[0] if @{ $self->{forms} }; $self->{links} = $self->extract_links(); } return $self->{res}; } This way, the usual request(), simple_request() and send_request() methods will update the WWW::Mechanize specific data, so that they'll be available for any request.
Thanks Book. I've made this change in 0.42.