line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cikl::Smrt::Fetchers; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2341
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
5
|
use URI; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
1327
|
use Data::Dumper; |
|
1
|
|
|
|
|
8661
|
|
|
1
|
|
|
|
|
75
|
|
7
|
|
|
|
|
|
|
#use Cikl::Smrt::Fetcher; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
10
|
1
|
|
|
|
|
11
|
use Module::Pluggable search_path => "Cikl::Smrt::Fetchers", |
11
|
|
|
|
|
|
|
inner => 0, require => 1, sub_name => '_fetchers', |
12
|
|
|
|
|
|
|
on_require_error => \&croak |
13
|
1
|
|
|
1
|
|
875
|
; |
|
1
|
|
|
|
|
11724
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
4
|
|
|
4
|
0
|
4816
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
4
|
|
|
|
|
13
|
my $self = {}; |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
10
|
bless $self, $class; |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
14
|
$self->{fetchers} = $self->_init_fetchers(); |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
|
|
188
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _init_fetchers { |
28
|
4
|
|
|
4
|
|
7
|
my $self = shift; |
29
|
4
|
|
|
|
|
8
|
my $ret = {}; |
30
|
4
|
|
|
|
|
7
|
my @fetchers; |
31
|
4
|
|
|
|
|
25
|
foreach my $fetcher (__PACKAGE__->_fetchers()) { |
32
|
8
|
|
|
|
|
22476
|
foreach my $scheme ($fetcher->schemes()) { |
33
|
16
|
50
|
|
|
|
296
|
my $scheme = lc($scheme) if (defined($scheme)); |
34
|
16
|
50
|
|
|
|
237
|
if (my $existing = $ret->{$scheme}) { |
35
|
0
|
0
|
|
|
|
0
|
$scheme = 'undef' if (!defined($scheme)); # just make it printable |
36
|
0
|
|
|
|
|
0
|
die("Cannot associate parser '$fetcher' with the scheme '$scheme'. Already registered with $existing."); |
37
|
|
|
|
|
|
|
} |
38
|
16
|
|
|
|
|
373
|
$ret->{$scheme} = $fetcher; |
39
|
|
|
|
|
|
|
} |
40
|
8
|
|
|
|
|
186
|
push(@fetchers, $fetcher); |
41
|
|
|
|
|
|
|
} |
42
|
4
|
|
|
|
|
31
|
return $ret; |
43
|
|
|
|
|
|
|
#return \@fetchers; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub fetchers { |
47
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
48
|
0
|
|
|
|
|
0
|
return @{$self->{fetchers}}; |
|
0
|
|
|
|
|
0
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub lookup { |
52
|
6
|
|
|
6
|
0
|
14378
|
my $self = shift; |
53
|
6
|
|
|
|
|
10
|
my $feedurl = shift; |
54
|
6
|
|
|
|
|
54
|
my $scheme = $feedurl->scheme; |
55
|
6
|
100
|
|
|
|
1165
|
if (!defined($scheme)) { |
56
|
2
|
|
|
|
|
73
|
$scheme = '__undef__'; |
57
|
|
|
|
|
|
|
} |
58
|
6
|
|
|
|
|
11
|
$scheme = lc($scheme); |
59
|
6
|
|
|
|
|
24
|
return $self->{fetchers}->{$scheme}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |