blib/lib/CPAN/Faker/HTTPD.pm

filter: Statementstmt 97.5% 39 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.8% 13 / 14 Podpod 0.0% 0 / 1 totaltotal 94.5% 52 / 55 CC 1 SCAR 0.7
CC
1
Cov
98%
__ANON__
2.0
__ANON__
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package CPAN::Faker::HTTPD;
2 {
3 2 $CPAN::Faker::HTTPD::VERSION = '0.002';
4 }
5  
6 # ABSTRACT: Run a bogus CPAN web server for testing
7  
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Test::Fake::HTTPD;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use HTTP::Message::PSGI;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Plack::App::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use File::Temp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 extends 'CPAN::Faker';
18  
19 has '+dest' => (
20 is => 'ro',
21 isa => 'Str',
22 required => 0,
23 1 ▶ default => sub { File::Temp::tempdir( CLEANUP => 1 ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
24 2 );
25  
26 has 'httpd' => (
27 is => 'ro',
28 isa => 'Test::Fake::HTTPD',
29 handles => [qw(port host_post endpoint)],
30 1 ▶ default => sub { Test::Fake::HTTPD->new },
Subroutine __ANON__: called CC=1 SCAR=0.0
31 2 );
32  
33 has 'server' => (
34 is => 'ro',
35 isa => 'Plack::Component',
36 handles => { serve => 'call' },
37 1 ▶ default => sub { Plack::App::File->new( root => $_[0]->dest ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
38 2 );
39  
40 has 'app' => (
41 is => 'ro',
42 isa => 'CodeRef',
43 1 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.4
44 1 my $self = shift;
45 0 ▶ return sub { $self->serve($_[0]->to_psgi) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 1 },
47 2 );
48  
49 1 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
50 1 my $self = shift;
51 1 $self->httpd->run( $self->app );
52 };
53  
54 2 __PACKAGE__->meta->make_immutable;
55  
56  
57 __END__
↑ Summary