lib/Finance/Bank/Wachovia/Credit.pm

filter: Statementstmt 90.2% 74 / 82 Branchbran 65.3% 17 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 95.2% 20 / 21 Podpod 71.4% 5 / 7 totaltotal 85.2% 116 / 136 SCAR 28.3
CC
16
Cov
84%
name
3.4
available_credit
3.4
limit
3.3
CRAP 17.0
« lib/Finance/Bank/Wachovia.pm ↑ Summary lib/Finance/Bank/Wachovia/DataObtainer/WWW/Parser.pm »
1 package Finance::Bank::Wachovia::Credit;
2 3 ▶use Finance::Bank::Wachovia::ErrorHandler;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 our $VERSION = '0.3';
7 3 my @attrs;
8 3 our @ISA = qw/Finance::Bank::Wachovia::ErrorHandler/;
9  
10 BEGIN{
11 3 ▶ @attrs = qw(
Subroutine BEGIN: called CC=2 SCAR=6.9
12 name
13 number
14 type
15 current_balance
16 available_credit
17 limit
18 data_obtainer
19 );
20
21 3 my $x = @__SUPER__::ATTRIBUTES;
22 3 for( @attrs ){
23 21 ▶ eval "sub _$_ { $x }";
Subroutine _available_credit: called CC=1 SCAR=0.0
Subroutine _current_balance: called CC=1 SCAR=0.0
Subroutine _data_obtainer: called CC=1 SCAR=0.0
Subroutine _limit: called CC=1 SCAR=0.0
Subroutine _name: called CC=1 SCAR=0.0
Subroutine _number: called CC=1 SCAR=0.0
Subroutine _type: called CC=1 SCAR=0.0
24 21 $x++;
25 }
26 }
27  
28 sub new {
29 2 ▶ my($class, %attrs) = @_;
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
30 2 my $self = [];
31 2 bless $self, $class;
32 2 foreach my $att ( keys %attrs ){
33 4 $self->$att( $attrs{$att} );
34 }
35 2 ▶ return Finance::Bank::Wachovia::Credit->Error("no account number set in Finance::Bank::Wachovia::Credit->new")
Branch: 1 branch
BranchTrueFalseTotal
unless $self->number 0 2 2
36 unless $self->number;
37 2 return $self;
38 }
39  
40 sub AUTOLOAD {
41 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
42 17 ▶ our $AUTOLOAD;
Subroutine AUTOLOAD: called CC=3 SCAR=11.0
43 17 my $self = shift;
44 17 my $attr = lc $AUTOLOAD;
45 17 $attr =~ s/.*:://;
46 17 ▶ return $self->Error( "$attr not a valid attribute" )
Branch: 1 branch
BranchTrueFalseTotal
unless grep /$attr/, @attrs 0 17 17
47 unless grep /$attr/, @attrs;
48 # get if no args passed
49 17 ▶ return $self->[ &{"_$attr"} ] unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 13 4 17
50 # set if args passed
51 4 $self->[ &{"_$attr"} ] = shift;
52 4 return $self;
53 }
54  
55  
56 2 ▶sub balance { current_balance(@_) }
Subroutine balance: called CC=1 SCAR=0.0
Pod documented
57  
58 # these values are loaded on-demand
59 sub limit {
60 1 ▶ my $self = shift;
Subroutine limit: called CC=3 SCAR=11.8
Pod documented
61 1 ▶ if(@_){ $self->[ _limit ] = shift; return $self; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 1 1
62 1 ▶ return $self->[ _limit ] if $self->[ _limit ];
Branch: 1 branch
BranchTrueFalseTotal
if $$self[_limit()] 0 1 1
63 1 my $do = $self->data_obtainer();
64 1 my $limit = $do->get_credit_account_limit( $self->number() );
65 1 $self->[ _limit ] = $limit;
66 1 return $limit;
67 }
68  
69  
70 sub name {
71 1 ▶ my $self = shift;
Subroutine name: called CC=3 SCAR=12.3
Pod documented
72 1 ▶ if(@_){ $self->[ _name ] = shift; return $self; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 1 1
73 1 ▶ return $self->[ _name ] if $self->[ _name ];
Branch: 1 branch
BranchTrueFalseTotal
if $$self[_name()] 0 1 1
74 1 $self->[ _name ] = $self->data_obtainer->get_account_name( $self->number );
75 1 return $self->[ _name ];
76 }
77  
78 sub type {
79 3 ▶ my $self = shift;
Subroutine type: called CC=3 SCAR=11.0
Pod documented
80 3 ▶ if(@_){ $self->[ _type ] = shift; return $self; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 2 3
81 2 ▶ return $self->[ _type ] if $self->[ _type ];
Branch: 1 branch
BranchTrueFalseTotal
if $$self[_type()] 1 1 2
82 1 $self->[ _type ] = $self->data_obtainer->get_account_type( $self->number );
83 1 return $self->[ _type ];
84 }
85  
86 sub current_balance {
87 3 ▶ my $self = shift;
Subroutine current_balance: called CC=3 SCAR=11.6
Pod documented
88 3 ▶ if(@_){ $self->[ _current_balance ] = shift; return $self; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 3 3
89 3 ▶ return $self->[ _current_balance ] if $self->[ _current_balance ];
Branch: 1 branch
BranchTrueFalseTotal
if $$self[_current_balance()] 2 1 3
90 1 $self->[ _current_balance ] = $self->data_obtainer->get_credit_account_current_balance( $self->number );
91 1 return $self->[ _current_balance ];
92 }
93  
94  
95 sub available_credit {
96 1 ▶ my $self = shift;
Subroutine available_credit: called CC=3 SCAR=12.3
Pod undocumented
97 1 ▶ if(@_){ $self->[ _available_credit ] = shift; return $self; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 1 1
98 1 ▶ return $self->[ _available_credit ] if $self->[ _available_credit ];
Branch: 1 branch
BranchTrueFalseTotal
if $$self[_available_credit()] 0 1 1
99 1 $self->[ _available_credit ] = $self->data_obtainer->get_credit_account_available_credit( $self->number );
100 1 return $self->[ _available_credit ];
101 }
102  
103 ▶sub DESTROY {}
Subroutine DESTROY: not called CC=1 SCAR=0.0
104  
105 __END__
« lib/Finance/Bank/Wachovia.pm ↑ Summary lib/Finance/Bank/Wachovia/DataObtainer/WWW/Parser.pm »