http://qs1969.pair.com?node_id=202601

JPaul has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all,
I've recently become involved in a project that requires me use Authorize.Net's payment gateway to process credit cards. Being a good little perler I used the modules that already exist to talk with AuthNet, Business::OnlinePayment and Business::OnlinePayment::AuthorizeNet.
Unfortunately I've discovered an issue that, while not causing the module to die, gives me a bunch of redefine errors that I'm sure shouldn't be.

The code snippet below is missing a bunch of the information you're supposed to pass through, but its not relevant for our immediate purposes.

my $tx = new Business::OnlinePayment("AuthorizeNet"); $tx->content( type => $cardtype, login => $login, password => $pass, amount => $amount, card_number => $ccnum, expiration => $ccexp); $tx->submit(); if($tx->is_success()) { &do_something; } else { &another; } $tx = new Business::OnlinePayment("AuthorizeNet"); $tx->content( type => $cardtype, login => $login, password => $pass, amount => $amount, card_number => $ccnum, expiration => $ccexp); $tx->submit if($tx->is_success()) { &do_something; } else { &another; }
This code is, of course, contrived, and only for demonstration purposes. My actual code has a single instance stored in a subroutine which I call to and pass along the transaction details.
When example is run I get a lovely stack of errors for the second transaction like:
Subroutine server_response redefined at (eval 19) line 1. Subroutine path redefined at (eval 20) line 1. Subroutine require_avs redefined at (eval 21) line 1. Subroutine port redefined at (eval 22) line 1.
Plus a number more I didn't want to spam you all with.

While these errors aren't fatal, I know it shouldn't doing this... Can anyone enlighten me what I can do to the module to "fix" this... Or whether its safe to simply ignore them...

My thanks,
JP
-- Alexander Widdlemouse undid his bellybutton and his bum dropped off --