I agree. Sorry about that.
This sub is what is currently working to log me in to Yahoo with ActivePerl:
sub login{
print "Logging in to Yahoo...";
#set url to page requiring login and password
my $url = 'http://login.yahoo.com/config/login?.done=http://fantas
+ysports.yahoo.com&.src=spt&.intl=us';
$mech->get( $url ) or die("Could not get $url\n");
#these two fields were specfic to the Yahoo login HTML field name
+s
#for login and password.
$mech->field("login", 'my_username');
$mech->field("passwd", 'my_password');
$mech->click();
print "Done.\n";
}#sub login
And the original error message was actually with the $mech->field() methods. They failed on the Linux box first. After re-reading the documentation on CPAN, I tried a different way of setting the values for those fields, and I was able to fix that problem by using this code instead of the two $mech->field lines above above:
$mech->set_visible( "my_username", "my_password");
However, apparently the submission is not working because I am not downloading the HTML content that should be there after logging in. It actually downloads an HTML page telling me that I haven't logged in.
So now my linux box code looked like this:
sub login{
print "Logging in to Yahoo...";
#set url to page requiring login and password
my $url = 'http://login.yahoo.com/config/login?.done=http://fantas
+ysports.yahoo.com&.src=spt&.intl=us';
$mech->get( $url ) or die("Could not get $url\n");
#these two fields were specfic to the Yahoo login HTML field name
+s
#for login and password.
$mech->set_visible( "my_username", "my_password");
$mech->click();
print "Done.\n";
}#sub login
That's when I began Dumping the form to make sure the login and password fields were actually being set to the correct values, and they are.
So tried a few other submission methods other than $mech->click(). Like the following:
$mech->submit();
...and...
my $button = $mech->current_form()->find_input(undef, "submit");
$mech->click_button(input => $button)
None of these worked. Again, any help would be greatly appreciated.
|