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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.