|Pathologically Eclectic Rubbish Lister|
Input 'foo' is readonly / WWW::Mechanizeby talexb (Canon)
|on Jan 25, 2008 at 16:08 UTC||Need Help??|
talexb has asked for the
wisdom of the Perl Monks concerning the following question:
I am using the most excellent Test::WWW::Mechanize::CGIApp to test my web application, and I appear to have run into a snag.
I want to set some values in a form, but since the form values are stored in a hash, the values that I set may be superceded by the default values. So my plan was to get all of the form's key/value pairs and copy everything over to a new list, except for the keys that I want to change.
I did this by getting the form from Mech, then extracting the key/value pairs from the form ..
.. then I looped through the key/value pairs, transferring over everything except the fields I'm going to be monkeying with ..
.. and finally I used Mech's set_fields method to set the form's fields.
This produced the following errors:
Is there a better way to solve this problem? I haven't tried just setting the field values -- I assume that because it's a hash, it will work sometimes and other times will not.
Update: Aha -- of course, the readonly variables are the variables that are 'hidden' in the original page. I don't feel like I'm that much closer to a solution, however.
Update 2: I have tried calling set_field without all of the cleverness shown above, and it seems to work properly .. so perhaps this effort was in vain. I certainly am learning a lot about using Test::WWW::Mechanize::CGIApp, in any case, and that's definitely a Good Thing. Thanks to all the monks who read this node.