Bankwest/Parser/Login.pm

filter: Statementstmt 95.0% 58 / 61 Branchbran 62.5% 10 / 16 Conditioncond 43.3% 13 / 30 MC/DCmcdc 27.7% 5 / 18 Subroutinesub 100% 17 / 17 Podpod n/a totaltotal 72.5% 103 / 142 CC 19 SCAR 23.6
CC
19
Cov
76%
__ANON__
17.7
handle
17.7
__ANON__
1.0
CRAP 10.6
↑ Summary Bankwest/Parser/TransactionSearch.pm »
1 package Finance::Bank::Bankwest::Parser::Login;
2 # ABSTRACT: Online Banking login web page parser
3 9 $Finance::Bank::Bankwest::Parser::Login::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::Login
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.2
11 10 ▶ use Finance::Bank::Bankwest::Error::NotLoggedIn::BadCredentials ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶ use Finance::Bank::Bankwest::Error::NotLoggedIn::SubsequentLogin ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 10 ▶ use Finance::Bank::Bankwest::Error::NotLoggedIn::Timeout ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 10 ▶ use Finance::Bank::Bankwest::Error::NotLoggedIn::UnknownReason ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 10 ▶ use Web::Scraper qw{ scraper process };
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 17 ▶ my $scraper = scraper {
Subroutine __ANON__: called CC=1 SCAR=0.0
18 17 process '#Form1 h2', 'form' => 'TEXT';
19 17 process '#additionalMessageHeading', 'heading' => 'TEXT';
20 17 process '#AuthUC_lblMessage', 'bc' => 'TEXT';
21 17 process '#lblAdditionalLogonMessage', 'sl' => 'TEXT';
22 10 };
23 10 ▶ method handle {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=10 SCAR=28.8
Subroutine handle: called CC=10 SCAR=28.8
24 14 my $s = $scraper->scrape($self->response);
25 $self->decline
26 if not defined $s->{'form'}
27 14 ▶ or $s->{'form'} !~ m{ ^ \s* Login \s* $ }x;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x 2 12 14
unless defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x 0 3 3
Condition50%3/6
defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x
!ll&&!rl&&r
2012
defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x
!ll&&!rl&&r
003
MC/DC50%1/2
defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x
defined $s->{"form"} $s->{"form"} =~ / ^ \s* Login \s* $ /x
MC/DC0%0/2
defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x
defined $s->{"form"} $s->{"form"} =~ / ^ \s* Login \s* $ /x
Truth table66%2/3
A and B
A= defined $s->{"form"}B= $s->{"form"} =~ / ^ \s* Login \s* $ /x
ABresult
0X0
100
111
Truth table33%1/3
A and B
A= defined $s->{"form"}B= $s->{"form"} =~ / ^ \s* Login \s* $ /x
ABresult
0X0
100
111
28 Finance::Bank::Bankwest::Error::NotLoggedIn::Timeout->throw
29 if defined $s->{'heading'}
30 12 ▶ and $s->{'heading'} eq 'Time Out';
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"heading"} and $s->{"heading"} eq "Time Out" 1 11 12
if defined $s->{"heading"} and $s->{"heading"} eq "Time Out" 3 0 3
Condition66%4/6
defined $s->{"heading"} and $s->{"heading"} eq "Time Out"
!ll&&!rl&&r
1011
defined $s->{"heading"} and $s->{"heading"} eq "Time Out"
!ll&&!rl&&r
003
MC/DC100%2/2
defined $s->{"heading"} and $s->{"heading"} eq "Time Out"
defined $s->{"heading"} $s->{"heading"} eq "Time Out"
MC/DC0%0/2
defined $s->{"heading"} and $s->{"heading"} eq "Time Out"
defined $s->{"heading"} $s->{"heading"} eq "Time Out"
Truth table100%3/3
A and B
A= defined $s->{"heading"}B= $s->{"heading"} eq "Time Out"
ABresult
0X0
100
111
Truth table33%1/3
A and B
A= defined $s->{"heading"}B= $s->{"heading"} eq "Time Out"
ABresult
0X0
100
111
31 Finance::Bank::Bankwest::Error::NotLoggedIn::BadCredentials->throw
32 if defined $s->{'bc'} and (
33 index($s->{'bc'}, "PAN and secure code don't match") >= 0
34 0 ▶ or index($s->{'bc'}, 'forgot to enter your PAN') >= 0
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1 4 7 11
if defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1 0 0 0
Condition33%4/12
defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1
!ll&&!rl&&r
704
index($s->{"bc"}, "PAN and secure code don't match") != -1 or index($s->{"bc"}, "forgot to enter your PAN") != -1
l!l&&r!l&&!r
220
defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1
!ll&&!rl&&r
000
index($s->{"bc"}, "PAN and secure code don't match") != -1 or index($s->{"bc"}, "forgot to enter your PAN") != -1
l!l&&r!l&&!r
000
MC/DC33%1/3
defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1
defined $s->{"bc"} index($s->{"bc"}, "PAN and secure code don't match") != -1 index($s->{"bc"}, "forgot to enter your PAN") != -1
MC/DC0%0/3
defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1
defined $s->{"bc"} index($s->{"bc"}, "PAN and secure code don't match") != -1 index($s->{"bc"}, "forgot to enter your PAN") != -1
Truth table75%3/4
A and B or C
A= defined $s->{"bc"}B= index($s->{"bc"}, "PAN and secure code don't match") != -1C= index($s->{"bc"}, "forgot to enter your PAN") != -1
ABCresult
0XX0
1000
11X1
1011
Truth table0%0/4
A and B or C
A= defined $s->{"bc"}B= index($s->{"bc"}, "PAN and secure code don't match") != -1C= index($s->{"bc"}, "forgot to enter your PAN") != -1
ABCresult
0XX0
1000
11X1
1011
35 );
36 Finance::Bank::Bankwest::Error::NotLoggedIn::SubsequentLogin->throw
37 if defined $s->{'sl'}
38 0 ▶ and index($s->{'sl'}, 'due to a subsequent logon') >= 0;
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1 1 6 7
if defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1 0 0 0
Condition33%2/6
defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1
!ll&&!rl&&r
601
defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1
!ll&&!rl&&r
000
MC/DC50%1/2
defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1
defined $s->{"sl"} index($s->{"sl"}, "due to a subsequent logon") != -1
MC/DC0%0/2
defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1
defined $s->{"sl"} index($s->{"sl"}, "due to a subsequent logon") != -1
Truth table66%2/3
A and B
A= defined $s->{"sl"}B= index($s->{"sl"}, "due to a subsequent logon") != -1
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"sl"}B= index($s->{"sl"}, "due to a subsequent logon") != -1
ABresult
0X0
100
111
39  
40 # The login form is being shown, with or without unanticipated
41 # error messages. In almost every case this is a bad thing, so
42 # throw an exception. If the caller is expecting a login form
43 # then they can catch the exception and carry on.
44 0 Finance::Bank::Bankwest::Error::NotLoggedIn::UnknownReason
45 ->throw( $self->response );
46 10 }
47 10 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 __END__
↑ Summary Bankwest/Parser/TransactionSearch.pm »