Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^4: Using Modules

by powerhouse (Friar)
on Oct 21, 2007 at 21:00 UTC ( #646314=note: print w/replies, xml ) Need Help??

in reply to Re^3: Using Modules
in thread Using Modules

I figured it out...

I'm not going to use them as modules... Since I have to build the gateway subroutine named chargeCard, I would just name it the name of the file + chargeCard, then when I pull the gateway to use out of the database, I'll call that subroutine that way:
my ($_merid,$_mertype) = $dbh->selectrow_array(qq{SELECT `id`,`type` F +ROM `merchants` WHERE #SomeWhereStatement#}); require "/path/to/modules/$_mertype.conf"; my $_subvar = $_mertype . "chargeCard"; my $cardCharged = &$_subvar($_merid);
and that does work... so now all I have to do is when I program each gateway, I just have to add it to the database first, figure out what type I made it then add that type to the forefront of the chargeCard subroutine name. And that will make them all dynamic, where I can use more than one at the same time... in case one gateway declines the transaction for some dumb reason other than no funds available.

Just thought I'd update this so people do not have to waste their time reading and trying to help me.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://646314]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2019-08-23 16:07 GMT
Find Nodes?
    Voting Booth?

    No recent polls found