SPORE/Definition.pm

filter: Statementstmt 56.5% 13 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 1 / 1 totaltotal 54.5% 18 / 33 CC 2 SCAR 9.2
CC
2
Cov
52%
_transport
6.0
_request
2.0
__ANON__
2.0
CRAP 2.5
« SPORE/Request.pm ↑ Summary SPORE.pm »
1 package Net::Async::SPORE::Definition;
2 3 $Net::Async::SPORE::Definition::VERSION = '0.003';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Net::Async::SPORE::Definition - holds information about a SPORE definition
9  
10 =head1 VERSION
11  
12 Version 0.003
13  
14 =head1 DESCRIPTION
15  
16 No user-serviceable parts inside. See L<Net::Async::SPORE::Loader> instead.
17  
18 =cut
19  
20 3 ▶use JSON::MaybeXS;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 =head2 new
23  
24 Instantiates this object.
25  
26 =cut
27  
28 1 ▶sub new { my $class = shift; bless { @_ }, $class }
Subroutine new: called CC=1 SCAR=0.0
Pod documented
29  
30 0 ▶sub _transport {
Subroutine _transport: not called CC=2 SCAR=17.9
31 0 my $self = shift;
32 0 ▶ return $self->{transport} if $self->{transport};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"transport"} 0 0 0
33  
34 # If we didn't have a transport, set one up -
35 # this is not the recommended usage and will
36 # probably change in future.
37 0 require IO::Async::Loop;
38 0 require Net::Async::HTTP;
39  
40 0 my $loop = IO::Async::Loop->new;
41 $loop->add(
42 0 $self->{_transport} = Net::Async::HTTP->new
43 );
44 $self->{_transport}
45 0 }
46  
47 0 ▶sub _request {
Subroutine _request: not called CC=1 SCAR=6.9
48 0 my ($self, $req) = @_;
49 $self->_transport->do_request(
50 request => $req
51 )->transform(
52 0 ▶ done => sub { decode_json(shift->content) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
53 )
54 0 }
55  
56 3 1;
57  
58 __END__
« SPORE/Request.pm ↑ Summary SPORE.pm »