return 0;
}
+my @Fraud_Class_Path = qw(Business::OnlinePayment Business::FraudDetect);
+
sub _pre_submit {
my ($self) = @_;
my $fraud_detection = $self->fraud_detect();
return 1 unless $fraud_detection;
# Search for an appropriate FD module
- foreach my $subclass ( q(Business::OnlinePayment::) . $fraud_detection,
- q(Business::FraudDetect::) . $fraud_detection) {
-
+ foreach my $fraud_class ( @Fraud_Class_Path ) {
+ my $subclass = $fraud_class . "::" . $fraud_detection;
if (!defined(&$subclass)) {
- eval "use $subclass";
+ eval "use $subclass ()";
if ($@) {
- Carp::croak("serious problem loading fraud_detection module ($@)") unless
- $@ =~ m/^Can\'t locate/;
+ Carp::croak("error loading fraud_detection module ($@)")
+ unless ( $@ =~ m/^Can\'t locate/ );
} else {
my $risk_tx = bless ( { processor => $fraud_detection } , $subclass );
$risk_tx->build_subs(keys %fields);
}
}
}
- return 1; # BUG?: success if fraud_detection module not found!
+ Carp::croak("Unable to locate fraud_detection module $fraud_detection"
+ . " in \@INC under Fraud_Class_Path (\@Fraud_Class_Path"
+ . " contains: @Fraud_Class_Path) (\@INC contains: @INC)");
}
sub content {