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