line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::UK::Parliament; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
69463
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
488
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
200154
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
820
|
use Module::Load qw/load/; |
|
1
|
|
|
|
|
962
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has instantiate => sub{ [qw/Bills CommonsVotes ErskineMay LordsVotes Members Now OralQuestions StatutoryInstruments Treaties WrittenQuestions/] }; |
13
|
|
|
|
|
|
|
has private => 0; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has instantiated => sub { {} }; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
19
|
0
|
0
|
0
|
|
|
|
my $self = bless @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {}, ref $class || $class; |
|
0
|
0
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
for my $instant (@{ $self->instantiate }) { |
|
0
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $class = sprintf "WebService::UK::Parliament::%s", $instant; |
22
|
0
|
|
|
|
|
|
load $class; |
23
|
0
|
|
|
|
|
|
$self->instantiated->{$instant} = $class->new( private => $self->private ); |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub AUTOLOAD { |
29
|
0
|
|
|
0
|
|
|
my ($self) = shift; |
30
|
0
|
|
|
|
|
|
my $classname = ref $self; |
31
|
0
|
|
|
|
|
|
my $validname = '[a-zA-Z][a-zA-Z0-9_]*'; |
32
|
0
|
|
|
|
|
|
our $AUTOLOAD =~ /^${classname}::($validname)$/; |
33
|
0
|
|
|
|
|
|
my $key = $1; |
34
|
0
|
0
|
|
|
|
|
die "illegal key name, must be of $validname form\n$AUTOLOAD" unless $key; |
35
|
0
|
|
|
|
|
|
return $self->instantiated->{ucfirst($key)}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |