QuoteHist.pm

filter: Statementstmt 51.7% 15 / 29 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 40.4% 19 / 47 CC 5 SCAR 26.6
CC
5
Cov
41%
new
30.0
default_lineup
2.0
granularities
2.0
CRAP 14.4
« QuoteHist/Yahoo.pm ↑ Summary QuoteHist/Yahoo/Australia.pm »
1 package Finance::QuoteHist;
2  
3 # Simple aggregator for Finance::QuoteHist::Generic instances,
4 # the primary function of which is to specify the order in which
5 # to try the modules upon failure.
6  
7 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use vars qw($VERSION $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 5 ▶use Finance::QuoteHist::Generic;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 $VERSION = '1.20';
14  
15 5 my @DEFAULT_ENGINES = qw(
16 Finance::QuoteHist::Yahoo
17 Finance::QuoteHist::Google
18 );
19  
20 sub new {
21 0 ▶ my $class = shift;
Subroutine new: not called CC=5 SCAR=34.0
Pod undocumented
22 0 my %parms = @_;
23 0 ▶ if (!$parms{lineup}) {
Branch: 3 branches
BranchTrueFalseTotal
if (not $parms{'lineup'}) { } 0 0 0
elsif (not ref $parms{'lineup'}) { } 0 0 0
elsif (ref $parms{'lineup'} ne 'ARRAY') { } 0 0 0
24 0 $parms{lineup} = [@DEFAULT_ENGINES];
25 }
26 elsif (! ref $parms{lineup}) {
27 0 $parms{lineup} = [$parms{lineup}];
28 }
29 elsif (ref $parms{lineup} ne 'ARRAY') {
30 0 croak "Lineup must be passed as an array ref or single-entry string\n";
31 }
32  
33 # Instantiate the first, pass the rest as champions to the first
34 0 my $first = shift @{$parms{lineup}};
35  
36 0 eval "require $first";
37 0 ▶ croak $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
38  
39 0 my $self = $first->new(%parms);
40  
41 0 $self;
42 }
43  
44 0 ▶sub default_lineup { @DEFAULT_ENGINES }
Subroutine default_lineup: not called CC=1 SCAR=6.9
Pod undocumented
45  
46 0 ▶sub granularities { Finance::QuoteHist::Generic->granularities }
Subroutine granularities: not called CC=1 SCAR=6.9
Pod undocumented
47  
48 5 1;
49 __END__
« QuoteHist/Yahoo.pm ↑ Summary QuoteHist/Yahoo/Australia.pm »