lib/Finance/Bank/Wachovia/DataObtainer/WWW/Parser.pm

filter: Statementstmt 100% 60 / 60 Branchbran 78.5% 11 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 9 totaltotal 87.2% 82 / 94 CC 9 SCAR 8.6
CC
9
Cov
96%
get_account_transactions
4.0
get_account_available_balance
3.0
get_account_name
3.0
CRAP 2.4
« lib/Finance/Bank/Wachovia/Account.pm ↑ Summary lib/Finance/Bank/Wachovia/Credit.pm »
1 package Finance::Bank::Wachovia::DataObtainer::WWW::Parser;
2 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶sub get_credit_account_current_balance {
Subroutine get_credit_account_current_balance: called CC=1 SCAR=0.0
Pod undocumented
6 1 get_account_available_balance( @_ );
7 }
8  
9 3 ▶sub get_credit_account_available_credit {
Subroutine get_credit_account_available_credit: called CC=1 SCAR=0.0
Pod undocumented
10 3 $_[-1] =~ /<!-- start description insertion -->Available Credit<!-- end description insertion -->/g;
11 3 my($avail) = $_[-1] =~ /\G.*?<!-- start amount insertion -->\$([\d,.-]+)<!-- end amount insertion -->/s;
12 3 $avail =~ s/,//g;
13 3 return $avail;
14 }
15  
16 3 ▶sub get_credit_account_limit {
Subroutine get_credit_account_limit: called CC=1 SCAR=0.0
Pod undocumented
17 3 $_[-1] =~ /<!-- start description insertion -->Credit Limit<!-- end description insertion -->/g;
18 3 my($limit) = $_[-1] =~ /\G.*?<!-- start amount insertion -->\$([\d,.-]+)<!-- end amount insertion -->/s;
19 3 $limit =~ s/,//g;
20 3 return $limit;
21 }
22  
23 12 ▶sub get_account_numbers {
Subroutine get_account_numbers: called CC=2 SCAR=6.9
Pod undocumented
24 12 my $content = $_[-1];
25 12 my @nums;
26 12 ▶ while( $content =~ m/<!-- begin data row -->/g ){
Branch: 1 branch
BranchTrueFalseTotal
if ($content =~ /<!-- begin data row -->/g) 26 12 38
27 26 my($num) = $content =~ /\G.*?HREF="javascript\:sendForm\('(\d+)','Account(?:Detail|Summary)'\)">.*?<\/A>/s;
28 26 push @nums, $num;
29 }
30 12 return @nums;
31 }
32  
33 13 ▶sub get_account_available_balance {
Subroutine get_account_available_balance: called CC=3 SCAR=11.0
Pod undocumented
34 13 my $account_num = $_[-1];
35 13 my $content = $_[-2];
36 13 ▶ while($content =~ m/<!-- begin data row -->/g){
Branch: 1 branch
BranchTrueFalseTotal
if ($content =~ /<!-- begin data row -->/g) 25 0 25
37 25 my($num) = $content =~ /\G.*?HREF="javascript\:sendForm\('(\d+)','Account(?:Detail|Summary)'\)">.*?<\/A>/s;
38 25 my $bal;
39 25 ($bal) = $content =~ /\G.*?\$(\-?[\d,.-]+)/s;
40 25 $bal =~ s/,//g;
41 25 ▶ if( $num eq $account_num ){
Branch: 1 branch
BranchTrueFalseTotal
if ($num eq $account_num) 13 12 25
42 13 return $bal;
43 }
44 }
45 }
46  
47 2 ▶sub get_account_posted_balance {
Subroutine get_account_posted_balance: called CC=1 SCAR=0.0
Pod undocumented
48 2 my $content = $_[-1];
49 2 my $bal;
50 2 ($bal) = $content =~ m|Posted Balance: &nbsp;&nbsp;&nbsp;</B><!-- start balance insertion -->\$([\d,.-]+)|g;
51 2 $bal =~ s/,//g;
52 2 return $bal;
53 }
54  
55 13 ▶sub get_account_name {
Subroutine get_account_name: called CC=3 SCAR=11.0
Pod undocumented
56 13 my $account_num = $_[-1];
57 13 my $content = $_[-2];
58 13 ▶ while($content =~ m/<!-- begin data row -->/g){
Branch: 1 branch
BranchTrueFalseTotal
if ($content =~ /<!-- begin data row -->/g) 23 0 23
59 23 my($num,$name) = $content =~ /\G.*?HREF="javascript\:sendForm\('(\d+)','Account(?:Detail|Summary)'\)">(.*?)<\/A>/s;
60 23 my $bal;
61 23 ($bal) = $content =~ /\G.*?\$(\-?[\d,.-]+)/s;
62 23 $bal =~ s/,//g;
63 23 ▶ if( $num eq $account_num ){
Branch: 1 branch
BranchTrueFalseTotal
if ($num eq $account_num) 13 10 23
64 13 return lc $name;
65 }
66 }
67 }
68  
69 5 ▶sub get_account_type {
Subroutine get_account_type: called CC=1 SCAR=0.0
Pod undocumented
70 5 my $content = $_[-1];
71 5 my $type;
72 5 ($type) = $content =~ m/<!-- start account type insertion -->(.+?)<!-- end account type insertion -->/g;
73 5 return lc $type;
74 }
75  
76 4 ▶sub get_account_transactions {
Subroutine get_account_transactions: called CC=4 SCAR=13.9
Pod undocumented
77 4 my $content = $_[-1];
78 4 my @all_trans;
79 4 ▶ while( $content =~ m/^var tblRow\d+ = new Array (.+?);$/mg ){
Branch: 1 branch
BranchTrueFalseTotal
if ($content =~ /^var tblRow\d+ = new Array (.+?);$/gm) 292 4 296
80 292 my %trans;
81 @trans{
82 292 qw(
83 date
84 action
85 description
86 withdrawal_amount
87 deposit_amount
88 balance
89 seq_no
90 trans_code
91 check_num
92 )
93 } = eval $1;
94 # this loop just gets rid of some dollar signs and commas that we don't need
95 292 for(qw/withdrawal_amount deposit_amount balance/){
96 876 ▶ next unless $trans{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $trans{$_} 0 876 876
97 876 $trans{$_} =~ s/\$|,//g;
98 876 $trans{$_} =~ s/&nbsp;//g;
99 }
100 292 push @all_trans, \%trans;
101 }
102 4 return \@all_trans;
103 }
104  
105 8 1;
« lib/Finance/Bank/Wachovia/Account.pm ↑ Summary lib/Finance/Bank/Wachovia/Credit.pm »