line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Importer::Parltrack; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
11427
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
112
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
88
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
588
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
82879
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
332
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
846
|
use Types::Standard qw( Bool ); |
|
1
|
|
|
|
|
58195
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
1044
|
use URI::Template; |
|
1
|
|
|
|
|
15458
|
|
|
1
|
|
|
|
|
9
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Catmandu::Importer::getJSON'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JONASS'; |
14
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has api => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
default => sub {'http://parltrack.euwiki.org'} |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has '+url' => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
lazy => 1, |
24
|
|
|
|
|
|
|
builder => sub { |
25
|
0
|
|
|
0
|
|
|
URI::Template->new( $_[0]->api . '{/topic,reference}?format=json' ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has '+from' => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
lazy => 1, |
32
|
|
|
|
|
|
|
builder => \&_build_from, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has dossier => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has meps => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
isa => Bool, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has mep => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has committee => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _build_from |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $vars; |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
if ( $self->dossier ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$vars = { topic => 'dossier', reference => $self->dossier }; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif ( $self->meps ) { |
62
|
0
|
|
|
|
|
|
$vars = { topic => 'meps', reference => '' }; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
elsif ( $self->mep ) { |
65
|
0
|
|
|
|
|
|
$vars = { topic => 'mep', reference => $self->mep }; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif ( $self->committee ) { |
68
|
0
|
|
|
|
|
|
$vars = { topic => 'committee', reference => $self->committee }; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
return ( $vars ? $self->url->process($vars) : undef ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub request_hook |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
0
|
1
|
|
my ( $self, $line ) = @_; |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
if ( $line =~ /^\/([a-z]+)\/(.+)$/ ) { |
79
|
0
|
|
|
|
|
|
return { topic => $1, reference => $2 }; |
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
|
|
|
return; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |