Changed the logic in the symbol-table magic to punt if the processor
authorlawrence <lawrence>
Thu, 31 Aug 2006 15:06:32 +0000 (15:06 +0000)
committerlawrence <lawrence>
Thu, 31 Aug 2006 15:06:32 +0000 (15:06 +0000)
class does not have a submit() method.

This bug *only* affected testing -- properly written processors that
declared a submit() method would not have experienced the
deep-recursion failure.

bop.t reverted to continue testing with the MOCK1 processor.

I see opportunities for more tests....

OnlinePayment.pm
t/bop.t

index 871d555..874176d 100644 (file)
@@ -58,11 +58,15 @@ sub new {
        no strict 'refs';
        no warnings 'redefine';
        my $submit = qualify_to_ref('submit', $subclass);
-       $self->{_child_submit} = \&$submit;
-       *{"${subclass}::submit"} = sub {
-           my $self = shift;
-           $self->_pre_submit();
-
+       unless ( $subclass->can('submit') eq
+                $class->can('submit'))
+       {
+           
+           $self->{_child_submit} = \&$submit;
+           *{"${subclass}::submit"} = sub {
+               my $self = shift;
+               $self->_pre_submit();
+           }
        }
     }
 
diff --git a/t/bop.t b/t/bop.t
index c3d7769..7b8f34e 100644 (file)
--- a/t/bop.t
+++ b/t/bop.t
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: bop.t,v 1.3 2006-08-30 18:48:40 plobbes Exp $
+# $Id: bop.t,v 1.4 2006-08-31 15:06:32 lawrence Exp $
 
 use strict;
 use warnings;
@@ -13,6 +13,7 @@ BEGIN { use_ok("Business::OnlinePayment") or exit; }
     use strict;
     use warnings;
     use base qw(Business::OnlinePayment);
+
 }
 
 my $package = "Business::OnlinePayment";
@@ -148,14 +149,9 @@ $INC{"Business/OnlinePayment/${driver}.pm"} = "testing";
     can_ok( $package, qw(submit) );
     can_ok( $obj,     qw(submit) );
 
-   # XXX
-   #    eval { $obj->submit; };
-   #    like( $@, qr/^Processor subclass did not /, "missing submit() croaks" );
-   #Tests turned off due to bug:
-   #  Deep recursion on anonymous subroutine
-   #    at .../Business/OnlinePayment.pm line 110.
-   #  Deep recursion on subroutine "Business::OnlinePayment::_pre_submit"
-   #    at .../Business/OnlinePayment.pm line 74.
+
+    eval { $obj->submit; };
+    like( $@, qr/^Processor subclass did not /, "missing submit() croaks" );
 }
 
 {    # dump_contents