EZTV/UA.pm

filter: Statementstmt 77.7% 14 / 18 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 60.6% 20 / 33 CC 5 SCAR 18.6
CC
5
Cov
58%
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 {
3 2 $WWW::EZTV::UA::VERSION = '0.05';
4 }
5 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: User agent for EZTV scrapper.
9  
10 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
11  
12 sub get_response {
13 2 ▶ my ($self, $url) = (shift, shift);
Subroutine get_response: called CC=4 SCAR=24.2
Pod documented
14  
15 2 my $tx = $self->ua->get( $url );
16 2 ▶ if ( my $res = $tx->success ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $res = $tx->success) { } 0 0 0
17 0 return $res;
18 }
19 else {
20 0 my ($err, $code) = $tx->error;
21 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
22 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
23 }
24 }
25  
26 2 1;
27  
28 __END__
29 =pod
30  
31 =encoding UTF-8
32  
33 =head1 NAME
34  
35 WWW::EZTV::UA - User agent for EZTV scrapper.
36  
37 =head1 VERSION
38  
39 version 0.05
40  
41 =head1 METHODS
42  
43 =head2 get_response
44  
45 =head1 AUTHOR
46  
47 Diego Kuperman <diego@freekeylabs.com>
48  
49 =head1 COPYRIGHT AND LICENSE
50  
51 This software is copyright (c) 2012 by Diego Kuperman.
52  
53 This is free software; you can redistribute it and/or modify it under
54 the same terms as the Perl 5 programming language system itself.
55  
56 =cut
57  
« EZTV/Link.pm ↑ Summary EZTV/Show.pm »