Bankwest/Parser/TransactionSearch.pm

filter: Statementstmt 100% 75 / 75 Branchbran 89.2% 25 / 28 Conditioncond 62.5% 15 / 24 MC/DCmcdc 43.7% 7 / 16 Subroutinesub 100% 18 / 18 Podpod n/a totaltotal 86.9% 140 / 161 CC 25 SCAR 21.7
CC
25
Cov
91%
__ANON__
13.5
handle
13.5
__ANON__
1.0
CRAP 8.8
« Bankwest/Parser/Login.pm ↑ Summary Bankwest/Transaction.pm »
1 package Finance::Bank::Bankwest::Parser::TransactionSearch;
2 # ABSTRACT: transaction search page parser
3 9 $Finance::Bank::Bankwest::Parser::TransactionSearch::VERSION = '1.2.8';
4  
5 ## no critic (RequireUseStrict, RequireUseWarnings, RequireEndWithOne)
6 10 ▶use MooseX::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use HTTP::Response::Switch::Handler 1.000000;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 class Finance::Bank::Bankwest::Parser::TransactionSearch
9 with HTTP::Response::Switch::Handler
10 10 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
11 10 ▶ use Finance::Bank::Bankwest::Error::ExportFailed ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶ use Finance::Bank::Bankwest::Error::ExportFailed::UnknownReason ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 10 ▶ use Web::Scraper qw{ scraper process };
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 14 ▶ my $scraper = scraper {
Subroutine __ANON__: called CC=1 SCAR=0.0
16 14 process '#headingBar',
17 'heading' => 'TEXT';
18 14 process '#_ctl0_valSummary ul li',
19 'errors[]' => 'TEXT';
20 14 process '#_ctl0_ContentMain_valAccount_custom1',
21 'acct_style' => '@style';
22 process '#_ctl0_ContentMain_dpFromDate_valCheck_custom1',
23 14 ▶ 'from_date_err' => sub { 1 };
Subroutine __ANON__: called CC=1 SCAR=0.0
24 process '#_ctl0_ContentMain_dpFromDate_valCheck_custom2',
25 14 ▶ 'from_date_err' => sub { 1 };
Subroutine __ANON__: called CC=1 SCAR=0.0
26 process '#_ctl0_ContentMain_dpToDate_valCheck_custom1',
27 14 ▶ 'to_date_has_err' => sub { 1 };
Subroutine __ANON__: called CC=1 SCAR=0.0
28 14 process '#_ctl0_ContentMain_valToDate',
29 'tdate_style' => '@style';
30 10 };
31 10 ▶ method handle {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=13 SCAR=26.1
Subroutine handle: called CC=13 SCAR=26.1
32 10 my $scrape = $scraper->scrape($self->response);
33  
34 $self->decline if not $scrape->{'heading'}
35 10 ▶ or $scrape->{'heading'} !~ /^\s*Transaction\s+Search\s*$/x;
Branch: 2 branches
BranchTrueFalseTotal
unless $scrape->{"heading"} and $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x 1 9 10
unless $scrape->{"heading"} and $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x 1 3 4
Condition66%4/6
$scrape->{"heading"} and $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
!ll&&!rl&&r
109
$scrape->{"heading"} and $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
!ll&&!rl&&r
013
MC/DC50%1/2
$scrape->{"heading"} and $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
$scrape->{"heading"} $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
MC/DC50%1/2
$scrape->{"heading"} and $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
$scrape->{"heading"} $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
Truth table66%2/3
A and B
A= $scrape->{"heading"}B= $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
ABresult
0X0
100
111
Truth table66%2/3
A and B
A= $scrape->{"heading"}B= $scrape->{"heading"} =~ /^\s*Transaction\s+Search\s*$/x
ABresult
0X0
100
111
36  
37 9 my %ef;
38 $ef{'account'}++ if defined $scrape->{'acct_style'}
39 9 ▶ and index($scrape->{'acct_style'}, ';display:none;') < 0;
Branch: 2 branches
BranchTrueFalseTotal
if defined $scrape->{"acct_style"} and index($scrape->{"acct_style"}, ";display:none;") == -1 2 7 9
if defined $scrape->{"acct_style"} and index($scrape->{"acct_style"}, ";display:none;") == -1 1 2 3
Condition66%4/6
defined $scrape->{"acct_style"} and index($scrape->{"acct_style"}, ";display:none;") == -1
!ll&&!rl&&r
072
defined $scrape->{"acct_style"} and index($scrape->{"acct_style"}, ";display:none;") == -1
!ll&&!rl&&r
021
MC/DC50%1/2
defined $scrape->{"acct_style"} and index($scrape->{"acct_style"}, ";display:none;") == -1
defined $scrape->{"acct_style"} index($scrape->{"acct_style"}, ";display:none;") == -1
MC/DC50%1/2
defined $scrape->{"acct_style"} and index($scrape->{"acct_style"}, ";display:none;") == -1
defined $scrape->{"acct_style"} index($scrape->{"acct_style"}, ";display:none;") == -1
Truth table66%2/3
A and B
A= defined $scrape->{"acct_style"}B= index($scrape->{"acct_style"}, ";display:none;") == -1
ABresult
0X0
100
111
Truth table66%2/3
A and B
A= defined $scrape->{"acct_style"}B= index($scrape->{"acct_style"}, ";display:none;") == -1
ABresult
0X0
100
111
40 9 ▶ $ef{'from_date'}++ if $scrape->{'from_date_err'};
Branch: 2 branches
BranchTrueFalseTotal
if $scrape->{"from_date_err"} 4 5 9
if $scrape->{"from_date_err"} 0 3 3
41 9 ▶ $ef{'to_date'}++ if $scrape->{'to_date_has_err'};
Branch: 2 branches
BranchTrueFalseTotal
if $scrape->{"to_date_has_err"} 3 6 9
if $scrape->{"to_date_has_err"} 0 3 3
42 $ef{'to_date'}++ if defined $scrape->{'tdate_style'}
43 9 ▶ and index($scrape->{'tdate_style'}, ';display:none;') < 0;
Branch: 2 branches
BranchTrueFalseTotal
if defined $scrape->{"tdate_style"} and index($scrape->{"tdate_style"}, ";display:none;") == -1 1 8 9
if defined $scrape->{"tdate_style"} and index($scrape->{"tdate_style"}, ";display:none;") == -1 0 3 3
Condition50%3/6
defined $scrape->{"tdate_style"} and index($scrape->{"tdate_style"}, ";display:none;") == -1
!ll&&!rl&&r
081
defined $scrape->{"tdate_style"} and index($scrape->{"tdate_style"}, ";display:none;") == -1
!ll&&!rl&&r
030
MC/DC50%1/2
defined $scrape->{"tdate_style"} and index($scrape->{"tdate_style"}, ";display:none;") == -1
defined $scrape->{"tdate_style"} index($scrape->{"tdate_style"}, ";display:none;") == -1
MC/DC0%0/2
defined $scrape->{"tdate_style"} and index($scrape->{"tdate_style"}, ";display:none;") == -1
defined $scrape->{"tdate_style"} index($scrape->{"tdate_style"}, ";display:none;") == -1
Truth table66%2/3
A and B
A= defined $scrape->{"tdate_style"}B= index($scrape->{"tdate_style"}, ";display:none;") == -1
ABresult
0X0
100
111
Truth table33%1/3
A and B
A= defined $scrape->{"tdate_style"}B= index($scrape->{"tdate_style"}, ";display:none;") == -1
ABresult
0X0
100
111
44  
45 9 ▶ if ($scrape->{'errors'}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($scrape->{"errors"}) 8 1 9
if ($scrape->{"errors"}) 1 2 3
46 8 s{ ^ \s+ }{}x for @{ $scrape->{'errors'} };
47 }
48 9 ▶ if ($scrape->{'errors'} or keys %ef) {
Branch: 2 branches
BranchTrueFalseTotal
if ($scrape->{"errors"} or keys %ef) 8 1 9
if ($scrape->{"errors"} or keys %ef) 1 2 3
Condition66%4/6
$scrape->{"errors"} or keys %ef
l!l&&r!l&&!r
801
$scrape->{"errors"} or keys %ef
l!l&&r!l&&!r
102
MC/DC50%1/2
$scrape->{"errors"} or keys %ef
$scrape->{"errors"} keys %ef
MC/DC50%1/2
$scrape->{"errors"} or keys %ef
$scrape->{"errors"} keys %ef
Truth table66%2/3
A or B
A= $scrape->{"errors"}B= keys %ef
ABresult
1X1
011
000
Truth table66%2/3
A or B
A= $scrape->{"errors"}B= keys %ef
ABresult
1X1
011
000
49 Finance::Bank::Bankwest::Error::ExportFailed->throw(
50 8 errors => $scrape->{'errors'},
51 params => [keys %ef],
52 );
53 }
54  
55 # We have a transaction search page with no apparent errors.
56 # Not a problem if the caller is expecting it, but very bad
57 # news otherwise--so throw an exception just in case.
58 Finance::Bank::Bankwest::Error::ExportFailed::UnknownReason
59 1 ->throw($self->response);
60 10 }
61 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 __END__
« Bankwest/Parser/Login.pm ↑ Summary Bankwest/Transaction.pm »