EZTV/Link.pm

filter: Statementstmt 57.1% 8 / 14 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod n/a totaltotal 40.9% 9 / 22 CC 4 SCAR 27.9
CC
4
Cov
40%
_guess_type
20.0
BEGIN
1.0
CRAP 16.2
« EZTV/Episode.pm ↑ Summary EZTV/UA.pm »
1 package WWW::EZTV::Link;
2 2 $WWW::EZTV::Link::VERSION = '0.06';
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 with 'WWW::EZTV::UA';
5  
6 # ABSTRACT: Episode link
7  
8 2 has url => is => 'ro', isa => 'Str', required => 1;
9  
10  
11 2 has type => is => 'ro', lazy => 1, builder => '_guess_type';
12  
13 sub _guess_type {
14 0 ▶ my $self = shift;
Subroutine _guess_type: not called CC=4 SCAR=30.0
15  
16 0 ▶ if ( $self->url =~ /magnet:/ ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($self->url =~ /magnet:/) { } 0 0 0
elsif ($self->url =~ /\.torrent$/) { } 0 0 0
elsif ($self->url =~ /bt-chat.com/) { } 0 0 0
17 0 return 'magnet';
18 }
19 elsif ( $self->url =~ /\.torrent$/ ) {
20 0 return 'torrent';
21 }
22 elsif ( $self->url =~ /bt-chat.com/ ) {
23 0 return 'torrent-redirect';
24 }
25  
26 0 return 'direct';
27 }
28 2 1;
29  
30 __END__
31  
32 =pod
33  
34 =encoding UTF-8
35  
36 =head1 NAME
37  
38 WWW::EZTV::Link - Episode link
39  
40 =head1 VERSION
41  
42 version 0.06
43  
44 =head1 ATTRIBUTES
45  
46 =head2 url
47  
48 Link address
49  
50 =head2 type
51  
52 Link type. It can be:
53  
54 - magnet
55 - torrent
56 - torrent-redirect (URL that do html/js redirect to a torrent file)
57 - direct
58  
59 =head1 AUTHOR
60  
61 Diego Kuperman <diego@freekeylabs.com>
62  
63 =head1 COPYRIGHT AND LICENSE
64  
65 This software is copyright (c) 2012 by Diego Kuperman.
66  
67 This is free software; you can redistribute it and/or modify it under
68 the same terms as the Perl 5 programming language system itself.
69  
70 =cut
« EZTV/Episode.pm ↑ Summary EZTV/UA.pm »