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

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