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: 2267
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: mvr707 [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.37
Fixed in: (no value)



Subject: agent->request
Download (untitled) / with headers
text/plain 739b
I needed to visit URL http://blah.com/aaa.asp wherein based on selection of a radio button, the action will be set to http://blah.com/bbb.asp (using JavaScript). Using WWW::Mechanize, here is what I had to do: $agent->get('http://blah.com/aaa.asp')->is_success or die; $agent->form(1) or die; my $f = $agent->current_form(); $f->action('http://blah.com/bbb.asp'); $f->value('UserName', '...'); $f->value('Password', '...'); $response = $agent->request($f->click()); $response->is_success or die; $content1 = $agent->content(); $content2 = $response->content() $content1 is stale and $content2 is the correct one. Is the code outlined (using $content2) the right approach? I expected $agent->content() was same as $response->content()
Download (untitled) / with headers
text/plain 852b
Show quoted text
> $agent->get('http://blah.com/aaa.asp')->is_success or die; > $agent->form(1) or die; > my $f = $agent->current_form(); > $f->action('http://blah.com/bbb.asp'); > $f->value('UserName', '...'); > $f->value('Password', '...'); > $response = $agent->request($f->click()); > $response->is_success or die; > > $content1 = $agent->content(); > $content2 = $response->content() > > $content1 is stale and $content2 is the correct one. > > Is the code outlined (using $content2) the right approach? > I expected $agent->content() was same as $response->content()
Yes, those contents should be the same. Here's the more Mechy way to write it: $agent->get('http://blah.com/aaa.asp'); $agent->success or die; $agent->form_number(1) or die; $agent->field( "UserName", "..." ); $agent->field( "Password", "..." ); $agent->submit(); $agent->success or die;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.