Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Just finishing up this thread in case someone else runs into this same issue. It turns out that WWW::Mechanize allows you to build and use your own HTTP::Request object through the use of the $a->request( $request ); method. This bypasses the need for HTML::Form, and allows you to enter any information into the form fields.

Here is a code snippet that shows how it can work:

use Test::More qw(no_plan); use WWW::Mechanize; use HTTP::Request::Common; my $url = 'http://starting.url/'; my $a = WWW::Mechanize->new(); isa_ok( $a, "WWW::Mechanize" ) or die; $a->get( $url ); is( $a->status, 200, 'Fetched OK' ); my $form = $a->form_name('details'); ok($form, 'Details form'); my $action = $form->action(); # build a request object my $request = HTTP::Request::Common::POST($action, [ a_radio_button => 'invalid_value', ]); # Add any cookies into the request object $a->cookie_jar->add_cookie_header( $request ); # make the request $a->request( $request ); is( $a->status, 200, 'Fetched OK' );

Thanks for the help and suggestions

- Cees


In reply to Re: HTTP::Form and invalid radio button values by cees
in thread HTTP::Form and invalid radio button values by cees

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-23 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found