[ic] global subs and "&charge", revisited (+REFORMATED)

josh simpson naugahyde@earthlink.net
Thu, 05 Oct 2000 17:28:45 -0400

[2nd try, same message as ~1 hour ago, w/ fingers crossed for better, maybe even
readable linewrap this time!]

Hey all,

   Sorry for the potential redundancy of this msg, but I'm having very little
luck with the minivend list archives on minivend.com
-- the search engine is totally screwy, & really ought to be fixed, imho.  A
search tells me that there have been threads on this topic
in the last few months, but none of the search returned links to those msgs
work.  Can't find 'em in my emails of the list digest either, but I could swear
I saw these somewhere. Anyhow ... In short, I am about to try to implement a
custom order route & card processing scheme, and I need to know if the following
comments, appended to the "Order Process/Advanced Multi-level Order Pages"
document by Steve Bergman in September, are accurate...

What he says :

                     "The info on &charge is quite incorrect. Your global sub
must return a perl
                     hash, e.g. %result, which contains at least the following
elements: MStatus
                     order-id MStatus must equal "success" and order-id must be
                     Otherwise the &charge operation will fail. e.g. the
following greatly
                     oversimplified global sub would always succeed: -------
GlobalSub <<EOS
                     sub webauthorize { my %result = ( "MStatus" => "success",
"order-id" =>
                     "00001", ); #my %result = ( "MStatus" => "success", );
return %result; } EOS
                     --------- I hope this saves someone else hours of grief.
;-) "

Is this true and/or complete?  I wonder if returns/re-credits work similarly?
Could someone clarify please?

Also, in a different vein, do GlobalSubs called called on a page with

            [perl subs=1]&mysubroutine[/perl]

accept arguments/references the same way that perl subroutine calls normally
do?  I want to pass a number of form values from the checkout page to my
subroutine, and my impression is this could be done w/

    &mysubroutine($Value=>customer,$Value=>whatever, etc.)

or perhaps just by passing the entire hash  %Values, which should get flattened
into an array of scalars that I can pick apart with $_[0], $_[1], etc. inside
the subroutine.

    Obviously, I'm just learing Perl, but perhaps someone can tell me how far
off-base I am!

Josh Simpson