On 8/10/07, Kelly Jones <[EMAIL PROTECTED]> wrote: > I've scraped an HTML page and gotten back a string that looks like this: > > [... bunch of stuff I don't care about ...] > <form action="foo.php" method="POST"> > <input type="hidden" name="val1" value="someval"> > <input type="text" name="val2" value="anotherval"> > <select name="selectfield"> > <option value="foo">bar > <option value="lala" SELECTED>some text here > <option value="thirdval">boing > </select></form> > [... bunch of stuff I don't care about ...] > > Is there a Perl module that will take this string and return a hash > representing the current (default) form values. IE, > > $HASH{'val1'} = "someval"; > $HASH{'val2'} = "anotherval"; > $HASH{'selectfield'} = "lala"; > > Ideally, the hash would include the field type, form action URL, etc, > but I'd be satisfied w/ just the name/value pairs. > > I'd then like to edit the HASH and re-"formify" it to get a string > suitable for POSTing (like > "val1=someval&val2=anotherval&selectfield=lala"). > > I don't think HTML::FillInForm does this, unless I'm misunderstanding it. > > I realize there are many issues here (some form values are lists, not > scalars-- people are lazy about using </option> close tags, etc), but > I figured there's a module out there that does this. > > Is there or should I roll my own?
Check CPAN for WWW:Mechanize -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/