CPAN-Faker-HTTPD
view release on metacpan or search on metacpan
VERSION
version 0.002
SYNOPSIS
use CPAN::Faker::HTTPD;
use LWP::Simple;
my $cpan = CPAN::Faker::HTTPD->new({ source => './eg' });
$cpan->make_cpan;
my $uri = $cpan->endpoint;
$uri->path( '/authors/id/P/PS/PSHANGOV/Miril-0.008.tar.gz' );
my $content = LWP::Simple::get( $uri );
$cpan->make_cpan;
DESCRIPTION
This module is a subclass of CPAN::Faker that additionally supplies a
running webserver (via Test::Fake::HTTPD). It is useful for testing code
that interacts with remote CPAN mirrors.
as the "httpd" parameter on construction.
See Test::Fake::HTTPD for details.
-head2 host_port
Host and port of the running server.
See Test::Fake::HTTPD for details.
endpoint
URI object for the full address of the running server (e.g.
"http://127.0.0.1:{port}").
See Test::Fake::HTTPD for details.
httpd
An instance of Test::Fake::HTTPD. Can be overriden during construction.
See Test::Fake::HTTPD for details.
lib/CPAN/Faker/HTTPD.pm view on Meta::CPAN
has '+dest' => (
is => 'ro',
isa => 'Str',
required => 0,
default => sub { File::Temp::tempdir( CLEANUP => 1 ) },
);
has 'httpd' => (
is => 'ro',
isa => 'Test::Fake::HTTPD',
handles => [qw(port host_post endpoint)],
default => sub { Test::Fake::HTTPD->new },
);
has 'server' => (
is => 'ro',
isa => 'Plack::Component',
handles => { serve => 'call' },
default => sub { Plack::App::File->new( root => $_[0]->dest ) },
);
lib/CPAN/Faker/HTTPD.pm view on Meta::CPAN
version 0.002
=head1 SYNOPSIS
use CPAN::Faker::HTTPD;
use LWP::Simple;
my $cpan = CPAN::Faker::HTTPD->new({ source => './eg' });
$cpan->make_cpan;
my $uri = $cpan->endpoint;
$uri->path( '/authors/id/P/PS/PSHANGOV/Miril-0.008.tar.gz' );
my $content = LWP::Simple::get( $uri );
$cpan->make_cpan;
=head1 DESCRIPTION
This module is a subclass of L<CPAN::Faker> that additionally supplies a
running webserver (via L<Test::Fake::HTTPD>). It is useful for testing code
lib/CPAN/Faker/HTTPD.pm view on Meta::CPAN
as the C<httpd> parameter on construction.
See L<Test::Fake::HTTPD> for details.
-head2 host_port
Host and port of the running server.
See L<Test::Fake::HTTPD> for details.
=head2 endpoint
L<URI> object for the full address of the running server (e.g.
C<http://127.0.0.1:{port}>).
See L<Test::Fake::HTTPD> for details.
=head2 httpd
An instance of L<Test::Fake::HTTPD>. Can be overriden during construction.
{ name => 'Multi::Relevant::Dropped', version => '1.00', in_file => 'lib/Multi/Relevant/Dropped.pm' },
{ name => 'Multi::Relevant::Stale', version => '1.00', in_file => 'lib/Multi/Relevant/Stale.pm' },
],
);
$cpan->add_dist($dist);
$cpan->$_ for qw(_update_author_checksums write_package_index
write_author_index write_modlist_index write_perms_index);
my $index_uri = $cpan->endpoint;
$index_uri->path('modules/02packages.details.txt.gz');
ok LWP::Simple::get($index_uri->as_string), "we have a 02packages";
my $dist_uri = $cpan->endpoint;
$dist_uri->path('authors/id/L/LO/LOCAL/Multi-Relevant-1.00.tar.gz');
ok LWP::Simple::get($dist_uri->as_string), "we have files in LOCAL's dir";
done_testing;
( run in 0.298 second using v1.01-cache-2.11-cpan-b61123c0432 )