App-starbucksloginator
view release on metacpan or search on metacpan
lib/App/starbucksloginator.pm view on Meta::CPAN
use WWW::Mechanize;
my $__agent__ = WWW::Mechanize->new;
$__agent__->agent( "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6" );
sub agent { $__agent__ }
sub try {
my $self = shift;
my $site = shift;
my $response = agent->get( "http://$site" );
my $success = $response->decoded_content !~ m/<title>[^<]*Starbucks.*?</i;
return ( $success, $response );
}
sub try_to_get_out {
my $self = shift;
my ( $success, $response );
for my $site ( qw/ google.com example.com bing.com yahoo.com / ) {
( $success, $response ) = $self->try( $site );
return ( $success, $response ) unless $success;
}
( run in 0.436 second using v1.01-cache-2.11-cpan-26ccb49234f )