[ic] GST/PST solution?

David Totten interchange-users@interchange.redhat.com
Fri Oct 12 11:19:00 2001


On Fri, Oct 12, 2001 at 09:34:16AM -0500, Jud Harris wrote:

<snip>

> Here's what I've got in the interchange.cfg -

Is there a specific reason that you have this in interchange.cfg?
I would recommend creating a file in usertags directory.

Any time you see a subroutine failed compilation: error, that most
likely means that you screwed up in your perl code. To test your perlcode,
take your usertag file (assuming it is in a file called tagname.tag and not
in interchange.cfg or catalog.cfg) and comment out all of the UserTag lines 
and the opening sub { and closing } and the EOR lines.

next run perl -c on tagname.tag (-c checks syntax) If there is an error,
fix it, and then you can uncomment all of the Interchange specific lines that
you had just commented out. Your usertag should now at least compile.

> 
> UserTag vat-calc Order table field
> UserTag vat-calc addAttr
> UserTag vat-calc Routine <<EOR
> sub {
>         my ($table, $field, $opt) = @_;
> 
>         my $error = sub {
>                 my $msg = shift;
>                 Log($msg);
>                 return undef;
>         }
> 
>         foreach my $item (@$Vend::Items) {
>                 my $taxrate = tag_data($table, $field, $item->{code});
>                 $tax += ($taxrate * $item->{quantity});
>         }
>         return $tax;
> }
> EOR 

In your file here, I see that you are missing a semi-colon at the end of your
definition for $error. It should look like this:

my $error = sub {
    my $msg = shift;
    Log($msg);
    return undef;
}; #<-- notice the semi-colon


-- 
___________________________________________________________________
GnuPG uid: 0x887B864C
Key fingerprint: 749E E8A9 E905 7372 163B  2D19 E8D6 4BA9 887B 864C
For more information about GnuPG, visit http://www.gnupg.org