line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Mowyw::Datasource; |
2
|
14
|
|
|
14
|
|
34908
|
use strict; |
|
14
|
|
|
|
|
16
|
|
|
14
|
|
|
|
|
293
|
|
3
|
13
|
|
|
13
|
|
39
|
use warnings; |
|
13
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
271
|
|
4
|
13
|
|
|
13
|
|
90
|
use Carp qw(confess); |
|
13
|
|
|
|
|
15
|
|
|
13
|
|
|
|
|
2730
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our %type_map = ( |
7
|
|
|
|
|
|
|
xml => 'XML', |
8
|
|
|
|
|
|
|
dbi => 'DBI', |
9
|
|
|
|
|
|
|
array => 'Array', |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
8
|
|
|
8
|
0
|
1089
|
my ($base, $opts) = @_; |
14
|
8
|
50
|
|
|
|
23
|
my $type = lc($opts->{type}) or confess "No 'type' given"; |
15
|
8
|
|
|
|
|
14
|
delete $opts->{type}; |
16
|
8
|
|
33
|
|
|
22
|
my $type_name = $type_map{$type} || confess "Don't know what to do with datasource type '$type'"; |
17
|
8
|
|
|
|
|
15
|
$type_name = "App::Mowyw::Datasource::$type_name"; |
18
|
8
|
|
|
3
|
|
453
|
eval "use $type_name;"; |
|
3
|
|
|
2
|
|
437
|
|
|
3
|
|
|
2
|
|
4
|
|
|
3
|
|
|
|
|
41
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
25
|
|
19
|
8
|
50
|
|
|
|
25
|
confess $@ if $@; |
20
|
8
|
100
|
|
|
|
335
|
my $obj = eval $type_name . "->new(\$opts)" or confess $@; |
21
|
5
|
|
|
|
|
24
|
return $obj; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# these are stubs for inherited classes |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
0
|
0
|
sub reset { confess "Called virtual method in base class!" } |
27
|
0
|
|
|
0
|
0
|
0
|
sub get { confess "Called virtual method in base class!" } |
28
|
0
|
|
|
0
|
0
|
0
|
sub next { confess "Called virtual method in base class!" } |
29
|
0
|
|
|
0
|
0
|
0
|
sub is_exhausted { confess "Called virtual method in base class!" } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |