Skip Menu |

This queue is for tickets about the Business-OnlinePayment CPAN distribution.

Report information
The Basics
Id: 7222
Status: resolved
Priority: 0/
Queue: Business-OnlinePayment

People
Owner: ivan-pause [...] 420.am
Requestors: e-rt.cpan [...] zacks.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 2.01
  • 2.00
  • 3.00_01
  • 3.00_02
  • 3.00_03
Fixed in: 3.00_04



Subject: "subroutine redefined" warnings in B::OP
Repeated "subroutine redefined at eval..." warnings appear when more than one Business::OnlinePayment object is created in a single program execution. Here is an example that demonstrates the problem: $ perl -MBusiness::OnlinePayment -we 'for( 1..2 ) { \ my $tx= Business::OnlinePayment->new('AuthorizeNet'); } ' Subroutine require_avs redefined at (eval 19) line 1. Subroutine path redefined at (eval 20) line 1. Subroutine port redefined at (eval 21) line 1. Subroutine authorization redefined at (eval 22) line 1. Subroutine is_success redefined at (eval 23) line 1. Subroutine result_code redefined at (eval 24) line 1. Subroutine error_message redefined at (eval 25) line 1. Subroutine server_response redefined at (eval 26) line 1. Subroutine server redefined at (eval 27) line 1. Subroutine transaction_type redefined at (eval 28) line 1. Subroutine test_transaction redefined at (eval 29) line 1. Subroutine order_number redefined at (eval 30) line 1. Subroutine md5 redefined at (eval 31) line 1. Subroutine avs_code redefined at (eval 32) line 1. I believe the problem is that the build_subs() routine, which is called from the new() constructor (and possibly a subclass set_defaults() method), does not test to see if the supplied subroutine names have already been defined. Attached is a patch to address this problem. System info: Business::OnlinePayment 2.01 Linux localhost 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux (Red Hat 9) This is perl, v5.8.0 built for i386-linux-thread-multi
diff -ur Business-OnlinePayment-2.01.orig/OnlinePayment.pm Business-OnlinePayment-2.01/OnlinePayment.pm --- Business-OnlinePayment-2.01.orig/OnlinePayment.pm 2004-07-03 18:18:28.000000000 -0400 +++ Business-OnlinePayment-2.01/OnlinePayment.pm 2004-07-27 14:05:41.000000000 -0400 @@ -118,6 +118,7 @@ sub build_subs { my $self = shift; foreach(@_) { + next if $self->can($_); eval "sub $_ { my \$self = shift; if(\@_) { \$self->{$_} = shift; } return \$self->{$_}; }"; } }
probably won't be fixed in 2.x? but will in 3.x if you want to help with 3.0 development, see http://420.am/business-onlinepayment/ng.html
fixed in 3.00_04