WWW-Mechanize-Plugin-Cache
view release on metacpan or search on metacpan
#!/usr/bin/perl -w
use strict;
use FindBin;
BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; }
use Test::More tests => 8;
use_ok( 'WWW::Mechanize::Pluggable' );
my $agent = WWW::Mechanize::Pluggable->new(cache=>1);
isa_ok( $agent, "WWW::Mechanize::Pluggable" );
SKIP: {
eval { require HTTP::Daemon; };
skip "HTTP::Daemon required to test the referrer header",10 if $@;
# We want to be safe from non-resolving local host names
delete $ENV{HTTP_PROXY};
# Now start a fake webserver, fork, and connect to ourselves
my $command = qq'"$^X" "$FindBin::Bin/cache-server"';
if ($^O eq 'VMS') {
$command = qq'mcr $^X t/cache-server';
}
open SERVER, "$command |" or die "Couldn't spawn fake server: $!";
sleep 1; # give the child some time
my $url = <SERVER>;
use warnings;
use strict;
use Test::More tests => 17;
use lib 't/local';
use LocalServer;
BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; }
BEGIN {
use_ok( 'WWW::Mechanize::Pluggable' );
}
sub pre_hook {
my ($self) = shift;
$self->{HOOK_OUTPUT} .= "pre done ";
1;
}
t/referer.t view on Meta::CPAN
#!/usr/bin/perl -w
use strict;
use FindBin;
BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; }
use Test::More tests => 13;
use_ok( 'WWW::Mechanize::Pluggable' );
my $agent = WWW::Mechanize::Pluggable->new();
isa_ok( $agent, "WWW::Mechanize::Pluggable" );
SKIP: {
eval { require HTTP::Daemon; };
skip "HTTP::Daemon required to test the referrer header",10 if $@;
# We want to be safe from non-resolving local host names
delete $ENV{HTTP_PROXY};
# Now start a fake webserver, fork, and connect to ourselves
my $command = qq'"$^X" "$FindBin::Bin/referer-server"';
if ($^O eq 'VMS') {
$command = qq'mcr $^X t/referer-server';
}
open SERVER, "$command |" or die "Couldn't spawn fake server: $!";
sleep 1; # give the child some time
my $url = <SERVER>;
t/reload-old.t view on Meta::CPAN
use warnings;
use strict;
use Test::More tests => 14;
use lib 't/local';
use LocalServer;
BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; }
BEGIN {
use_ok( 'WWW::Mechanize' );
}
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my $agent = WWW::Mechanize->new;
isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
use warnings;
use strict;
use Test::More tests => 14;
use lib 't/local';
use LocalServer;
BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; }
BEGIN {
use_ok( 'WWW::Mechanize::Pluggable' );
}
my $server = LocalServer->spawn;
isa_ok( $server, 'LocalServer' );
my $agent = WWW::Mechanize::Pluggable->new;
isa_ok( $agent, 'WWW::Mechanize::Pluggable', 'Created object' );
( run in 0.751 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )