MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: Calling a Perl subroutine from within a checkout profile.



******    message to minivend-users from "Gerard Olszowiec" <gerard@entitysoftware.com>     ******


-----Original Message-----
From: Erik Aase-Remedios <erik@fourfish.com>
To: Gerard Olszowiec <gerard@entitysoftware.com>
Cc: Minivend Maillist <Minivend-users@minivend.com>
Date: Wednesday, March 03, 1999 7:21 PM
Subject: Re: Calling a Perl subroutine from within a checkout profile.


>******    message to minivend-users from Erik Aase-Remedios
<erik@fourfish.com>     ******
>
>While I'm not quite sure how you would get access to the subroutine, you
>can't do it they way you are trying.
>The Global Sub exists in a seperate package than the one your [perl]
>[/perl] code exists in (see 'perldoc Safe').


Actually that is the reason for defining it globally.  The doc say:

"IMPORTANT NOTE: Global subroutines are not subject to the stringent
security checking of the Safe module, so almost anything goes there. The
subroutine will be able to modify any variable in MiniVend, and will be able
to write to read and write any file that the MiniVend daemon has permission
to write. Though this gives great power, it should be used with caution.
Careful! They are defined in the main minivend.cfg file, so should be safe
from individual users in a multi-catalog system."

My 'cc_auth' routine makes an external call via 'open()'.  The only way to
do that in MV is in a global sub.  [perl arg=sub
interpolate=1]cc_auth[/perl] does display the expected result, so 'cc_auth'
is available.  As I say, it doesn't seem to work in a profile using

[set receipt_profile]
...
[perl values config]
...
$cc_auth_results = &cc_auth();
...
[/perl]
...
[/set]

>Here's a guess at a way it might work, depending on interpolation order.
>Implement your subroutine as a UserTag, call that UserTag inside a [perl
>interpolate=1] container, just like when you do this: '$var = q{[scratch
>value]};'.
>
>Does that make sense?  You basically need to tell minivend to execute the
>subroutine for you and then feed that output to your perl code which then
>would give a result to the page.
>
>-Erik


Hmm...  I'll give that a try.


Cheers,
Gerard
------------------------------
Gerard Olszowiec
Entity Software
gerard@entitysoftware.com
www.entitysoftware.com

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: