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