Here's the basics of how the web testing object is set up. If WWW::Mechanize should automatically follow a redirect request, then perhaps there's something wrong I am doing in the setup?

package Foo::Webtest; use strict; use warnings; use URI; use Hook::LexWrap; use WWW::Mechanize; use Class::MethodMaker ( new => 'new', object => [ 'WWW::Mechanize' => { slot => 'browser', comp_mthds => [qw/ add_header agent_alias back base click content ct current_form field find_all_links find_link follow_link form_name form_number forms get is_html links quiet redirect_ok reload request response set_fields status submit submit_form success tick title untick uri /], } ]); my $start_time; my @times; my %URI; if ($ENV{TRACK_NAVIGATION}) { foreach my $method (qw/back click follow_link get reload submit subm +it_form/) { wrap $method, pre => sub {$start_time = time}, post => sub { my $end_time = time; my $time = $end_time - $start_time; push @times => $time; push @{$URI{$_[0]->base_uri}} => $time; } } }

The above code is my setup for the Mechanize object. I use Class::MethodMaker to ensure that I have a "hasa" relationship to Mechanize and all methods listed are delegated to the Mechanize object. Then, Hook::LexWrap is called to allow me to (loosely) time the fetch methods.

Later, I can do this:

my $webtest = Foo::Webtest->new; $webtest->get($page_to_test); # and then use the code in my root post

(Note that this was pared down fairly quickly). I am wondering if my weird setup is causing the problem. All I know right now is that I receive a redirect, but the $webtest->content still points to the page the original form is on. I was hoping it was simply a quick question on how to get the form to automatically follow, but if it's not, I can spend some time paring this down to a minimal test case.

Cheers,
Ovid

New address of my CGI Course.


In reply to Re: Re: Redirecting Forms with WWW::Mechanize by Ovid
in thread Redirecting Forms with WWW::Mechanize by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.