I play with Win32 :: IE :: Mechanize. I am trying to use a script to automatically access my six online accounts. the script basically works, but perl throws out a kind of critical "Cannot find object method" warn "through package" sssself "(maybe you forgot to load" sssself "). Despite the error, the script may still but I want to get rid of it and understand why this is happening. Next is the script. Please kindly let me know where I can improve the code. Thanks, as always.
use strict;
use Win32::IE::Mechanize;
my @accounts = (
'http://mail.21cn.com',
'frmmail1',
{
'Username' => 'myusername',
'passwd' => 'mypassword',
},
'http://mail.126.com',
'form',
{
'user' => 'myusername',
'password' => 'mypassword',
},
......
......
......
);
sub arg{
shift (@accounts);
}
while(@accounts){
my $mech = Win32::IE::Mechanize->new(visible=>1);
my $url = arg;
my $form = arg;
my $account = arg;
$mech->get($url);
$mech->form_name($form);
eval {$mech->set_fields(%$account);};
warn $@ if $@;
$mech->click();
}
I know something is wrong with the line
$mech->set_fields(%$account);
But how can I fix this? or i just delete
warn $@ if $@;
, ?
:)
UPDATE
, @daotoad, :) , .
, @Eric, , :)
, , Win32:: IE: Mechanize 0.009 cryptic
"warn" "sssself" (, l lad "sssself"?) C:/Perl/site/lib/Win32/IE/Mechanize.pm 971.
0.009_17 Dev Release :
'Username' E:\mailme.pl 33
, , "UserName", "Username".
, :)
, !