use WWW::Yahoo::Login qw( login logout ); use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $resp = login( mech => $mech, uri => 'http://mail.yahoo.com/', user => 'a_yahoo_user', pass => 'asecret', ); if ($resp) { print $mech->content; } else { warn $WWW::Yahoo::Login::ERROR; } # do some things unless ( logout(mech => $mech) ) { warn $WWW::Yahoo::Login::ERROR; }