Hi perlmonks,
I've got some code to work but I need an explanation of why it works.
I want to mechanize the login to a https://mysite.com.
Here is a snippet of my code.
my url = "https://mysite.com";
my $mech = WWW::Mechanize->new();
$mech->get($url);
$mech->follow_link(text => "Welcome", n => 1);
my $f = HTML::Form->parse(<<EOT, $url);
<form action="signin.jsp" onsubmit="returnblah();" method="post" id="s
+omethn_else">
<input type="text" name="username">user</input>
<input type="text" name="password">pass</input>
<input type="text" name="etc">etc</input>
</form>
EOT
# here is a workaround because of some javascript
$f->put_input("text", { name => "username" });
$f->value("username" => $username);
$f->put_input("text", { name => "password" });
$f->value("password" => $password);
$mech->submit();
Without the workaround my script doesn't work. But what I don't understand is how is it that $mech->submit() should include the changes I made with $f ??? How did they become associated? I didn't do, say, $mech->form($f->click->as_string); (which works by the way, with an error).
Thanks for any help,
Den.