| 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
Condition50%3/6
defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x
defined $s->{"form"} and $s->{"form"} =~ / ^ \s* Login \s* $ /x
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
Truth table33%1/3
A and B
A= defined $s->{"form"}B= $s->{"form"} =~ / ^ \s* Login \s* $ /x
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | Finance::Bank::Bankwest::Error::NotLoggedIn::Timeout->throw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | if defined $s->{'heading'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 12 | ▶ | and $s->{'heading'} eq 'Time Out'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
defined $s->{"heading"} and $s->{"heading"} eq "Time Out"
defined $s->{"heading"} and $s->{"heading"} eq "Time Out"
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"
Truth table33%1/3
A and B
A= defined $s->{"heading"}B= $s->{"heading"} eq "Time Out"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
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
index($s->{"bc"}, "PAN and secure code don't match") != -1 or index($s->{"bc"}, "forgot to enter your PAN") != -1
defined $s->{"bc"} and index($s->{"bc"}, "PAN and secure code don't match") != -1 || index($s->{"bc"}, "forgot to enter your PAN") != -1
index($s->{"bc"}, "PAN and secure code don't match") != -1 or index($s->{"bc"}, "forgot to enter your PAN") != -1
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
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition33%2/6
defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1
defined $s->{"sl"} and index($s->{"sl"}, "due to a subsequent logon") != -1
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
Truth table0%0/3
A and B
A= defined $s->{"sl"}B= index($s->{"sl"}, "due to a subsequent logon") != -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||