I'll try to answer some questions that have come up.
podmaster here is the Data::Dumper output of the array:
$VAR1 = bless( { 'fieldvals' => {}, 'checkboxstate' => {}, 'base' => undef, 'buttontypes' => { 'Submit2' => [ 'submit' ] }, 'buttons' => [ 'Submit2' ], 'upload' => 0, 'selections' => { 'bar' => [ undef, undef, undef ] }, 'buttonvals' => { 'Submit2' => [ 'Go!' ] }, 'method' => 'post', 'fieldtypes' => { 'bar' => 'select' }, 'fields' => [ 'bar' ], 'name' => 'form1', 'allfields' => [ 'bar' ], 'debug' => undef, 'link' => '/foo/bar.php' }, 'HTTP::Request::Form' );
As to what my problem is, in the 'selections' field it shows 3 undef values. So when I use the code like this:
$response = $userAgent->request( $form->press( "Submit2" ));
Those fields do not get filled in, and I do not get the response I need.
mp and rdfield, I found HTML::FORM, and before I was using HTTP::Request::Form. The data dumper output from this code:
@forms2 = HTML::Form->parse( $text, "here.com"); $d2 = Data::Dumper->new( \@forms2 ); print $d2->Dump;
Gives me:
$VAR1 = bless( { 'inputs' => [ bless( { 'seen' => [ 1, 0, 0 ], 'menu' => [ 'OPTION1', 'OPTION2', 'OPTION3' ], 'current' => 0, 'type' => 'option', 'name' => 'bar' }, 'HTML::Form::ListInput' ), bless( { 'class' => 'login', 'value' => 'Go!', 'type' => 'submit', 'name' => 'Submit2' }, 'HTML::Form::SubmitInput' ) ], 'extra_attr' => { 'name' => 'form1' }, 'enctype' => 'application/x-www-form-urlencoded', 'method' => 'POST', 'action' => bless( do{\(my $o = '/foo/bar.php')}, 'UR +I::_foreign' ) }, 'HTML::Form' );
Which looks like it parsed it right! I have yet to try it in my actual application, but it looks like it offers the same functionality, without having to build the tree first. Thanks!!!

In reply to Re: Parsing Forms with selections by Helter
in thread Parsing Forms with selections by Helter

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.