[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] How to use perl modules in minivend.
On Tue, 28 Sep 1999, Jarno Niemela wrote:
> ****** message to minivend-users from Jarno Niemela <jargon@iki.fi> ******
>
> UserTag calc-md-checksum ORDER cleartext
> UserTag calc-md-checksum ROUTINE <<EOR
> use MD5;
> sub
> {
> my ($cleartext)=@_;
> my $md5 = new MD5;
>
> my $md5->add($cleartext);
> my $digest = $md5->digest();
> my $hex = unpack("H*", $digest);
>
> $Safe{'scratch'}{'mdchecksum'}=$hex;
>
> }
> EOR
A couple of things:
1) you said that this is in catalog.cfg. Have you enabled global routines
in catalog.cfg? By default, MiniVend disables such routines in
catalog.cfg. They are enabled in minivend.cfg.
2) Try simply returning the value of the checksum:
UserTag calc-md-checksum ORDER cleartext
UserTag calc-md-checksum ROUTINE <<EOR
sub {
use MD5; # inside the block
...
my $hex = unpack...
return $hex;
}
EOR
Then use it in a scratch or value variable:
[scratch my_checksum][calc-md-checksum cleartext='...'][/scratch]
You probably need to set the interpolate flag to true.
Best,
Kyle