From 09f4ef51f7d1102f9a4869c8e947f765c728a9c4 Mon Sep 17 00:00:00 2001 From: lawrence Date: Thu, 31 Aug 2006 15:06:32 +0000 Subject: [PATCH] Changed the logic in the symbol-table magic to punt if the processor 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 | 14 +++++++++----- t/bop.t | 14 +++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/OnlinePayment.pm b/OnlinePayment.pm index 871d555..874176d 100644 --- a/OnlinePayment.pm +++ b/OnlinePayment.pm @@ -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 --- 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 -- 2.11.0