MiniVend Akopia Services

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

Re: [mv] Trouble getting piece of perl script working HELP!



This is getting very odd...

Half of my message disappeared again!

I hope that this will be the full post


Note I've deleted those parts that you answered already :)





With a lot's of experimenting (and coffee) I got the inpage version working.


But however, when I try to make it to work as user tag in catalog.cfg
The minivend comes up with the tag reference in the resulting page
(does this mean that it doesn't recognize the new tag)

I use following code in creating the tag.

UserTag calc-checksum ORDER bank_ref
UserTag calc-checksum Routine <<EOR
sub {   
my ($receipt_nr)=@_;      

my @multipliers = (7,3,1);

if ($receipt_nr =~ /([0-9]*)/)
{
    $receipt_nr = $1;
}
.
.
.
$Safe{'scratch'}{'viite'}=$bank_ref;

}
EOR

And I call it with following tag

Name of checksum: [calc-checksum bank_ref='12345'] [scratch viite]<BR>


Somehow I think that there's something I yet haven't quite got in the
minivend tags :(


Thanks for the tip about the reg-exp, I'll try it's as soon as I get the
rest working :)


>>         
>> $i = (length $receipt_nr) - 1;
>
>Length in Perl does not include a null termination character, so why the
>-1?

I comes with the agroritm, I calculating the typing checksum for the bank
payment
reference number. We like to use online accounts instead of credit cards
here in
Finland (much safer...).

>
>Try making this a UserTag:
>
>[checksum account='[value account]' ... ]
>
Whoa, does this mean that I first should create a value, which I would
then pass to the user tag?

>Some of the Perl seems like it might not be doing what you want.  It may
>work for you hard-coded value, but it might not for other things.

I'll be the one defining the receipt numbers, so I can make sure that they
are ok for the algorithm :)

>I have never had much luck with scratch variables.  Probably I am just
>missing some important point.  However, I have used 'value' variables with

I'll have to try that, was it so that the 'value' variables are defined in the
catalog.cfg

Thanks for help.

Jarno.







Search for: Match: Format: Sort by: