| 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
| |||||||||||||
| 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
| |||||||||||||
| 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'
MC/DC0%0/1
shift() || 'User agent error'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 20 | 0 | ▶ | confess sprintf('%s: %s (%s)', $message, $err, $code||'no error code'); | ||||||||||
|
Condition0%0/2
$code || 'no error code'
MC/DC0%0/1
$code || 'no error code'
$code
Truth table0%0/2
A
A= $code
| |||||||||||||
| 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 | ||||||||||||