EZTV/UA.pm

filter: Statementstmt 76.4% 13 / 17 Branchbran 25.0% 1 / 4 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 59.3% 19 / 32 CC 5 SCAR 18.6
CC
5
Cov
56%
get_response
11.3
__ANON__
2.1
BEGIN
1.0
CRAP 6.4
« EZTV/Link.pm ↑ Summary EZTV/Show.pm »
1 package WWW::EZTV::UA;
2 2 $WWW::EZTV::UA::VERSION = '0.06';
3 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: User agent for EZTV scrapper.
7  
8 2 ▶has ua => ( is => 'ro', lazy => 1, default => sub { $EZTV::Global::UA || ($EZTV::Global::UA = Mojo::UserAgent->new) } );
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$EZTV::Global::UA or $EZTV::Global::UA = "Mojo::UserAgent"->new 2 0 2
9  
10 sub get_response {
11 2 ▶ my ($self, $url) = (shift, shift);
Subroutine get_response: called CC=4 SCAR=24.2
Pod documented
12  
13 2 my $tx = $self->ua->get( $url );
14 2 ▶ if ( my $res = $tx->success ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $res = $tx->success) { } 0 0 0
15 0 return $res;
16 }
17 else {
18 0 my ($err, $code) = $tx->error;
19 0 ▶ my $message = shift || 'User agent error';
Condition0%0/2
shift() || 'User agent error'
l!l
00
MC/DC0%0/1
shift() || 'User agent error'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
20 0 ▶ confess sprintf('%s: %s (%s)', $message, $err, $code||'no error code');
Condition0%0/2
$code || 'no error code'
l!l
00
MC/DC0%0/1
$code || 'no error code'
$code
Truth table0%0/2
A
A= $code
Aresult
11
00
21 }
22 }
23  
24 2 1;
25  
26 __END__
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 WWW::EZTV::UA - User agent for EZTV scrapper.
35  
36 =head1 VERSION
37  
38 version 0.06
39  
40 =head1 METHODS
41  
42 =head2 get_response
43  
44 =head1 AUTHOR
45  
46 Diego Kuperman <diego@freekeylabs.com>
47  
48 =head1 COPYRIGHT AND LICENSE
49  
50 This software is copyright (c) 2012 by Diego Kuperman.
51  
52 This is free software; you can redistribute it and/or modify it under
53 the same terms as the Perl 5 programming language system itself.
54  
55 =cut
« EZTV/Link.pm ↑ Summary EZTV/Show.pm »