[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] LWP can't use globalsub in new version. Complains Safe: trapped by operator.
****** message to minivend-users from "Geoff" <minivend@hq.com.au> ******
I've implemented Bas's suggestions ;-) from
http://www.minivend.com/minivend/minivend-list/2000/msg02526.html but It
would appear that the latest version of Minivend will not let you run this
sub out of safe mode. It complains Safe: require trapped by operation mask
at /usr/lib/perl5/site_perl/5.005/LWP/UserAgent.pm line 4.
Any Ideas on how to get around the safe problem? Or maybe another easy way
of accessing a non minivend page/script from within minivend?
>Hi Shao,
>
>To fetch information from the www >>(payement service script or your own.
>script) i have constructed a little subroutine that helps me to communicate
>with my payment facility provider. The perl modules LWP and HTTP need to
be
>installed to let this work.
>
>you can make the request by doing something like in your page or order
>profile:
>[set name=ok interpolate=1][perl arg="sub" interpolate=1]geturl
>("http://__CHEKURL__?action=checkorder&ordernumber=103101")[/perl][/set]
>
>With the scratch variable you can do all sorts of things like:
>[if type=scratch term=ok op=eq compare="yes"]
>You have payed
>[else]
>You didn't pay. Try again.
>[/else]
>[/if]
>
>
>Here is the Global subroutine that needs to placed in minivend.cfg or in
>your shop catalog.cfg if you have the proper permissions.
>
>GlobalSub <<EndOfSub
>sub geturl {
>
>#
># This subroutine returns the response of a http request
># on a supplied url-address
>#
> my($url) = @_;
> require LWP::UserAgent;
> require HTTP::Request;
>
> print("geturl url $url\n") if $Global::DEBUG;
>
> my $string = "";
>
> $url = "http://$url" unless ($url =~ /^\w+:\/\//);
>
> my $ua = new LWP::UserAgent;
> my $request = new HTTP::Request 'GET', $url;
>
> my $response = $ua->request($request);
>
> if ($response->is_success)
>
> $string = $response->content();
> }
> return $string;
>}
>EndOfSub
>
>Greetings
>Bas Bezemer
-
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