[ic] Calling perl sub for custom shipping via shipping.asc

Mike Heins mikeh@minivend.com
Tue, 16 Jan 2001 08:55:14 -0500


Quoting James Griffiths (griffiths_james@yahoo.com):
> 
> Hello All,
> 
> The Interchange docs describe the option of calling
> a perl sub-routine to perform custom shipping 
> calculations by having a line in shipping.asc which
> has a cost field of the form :
> 
> s subname args
> 
> Is this syntax supported in current versions of 
> Interchange - my tests to date have yielded :
> 
> Note: Unknown shipping call 's test_ship_cost' No
> match found for mode 'testship', quantity '1', 
> returning 0.  
> 

That should have been removed from the docs -- I know I removed it
at one point but it appears to have snuck back in. s no longer applies
at all...

The way to do a subroutine is to write a UserTag

test_ship_cost	Test Ship	weight	0	999999	f [your-ship arg="[some tag]"]

or put in a [calc] block:

test_ship_cost	Test Ship	weight	0	999999	f <<EOF
[calc]
	my $var = q{[value foo]};
	your_code($var);
[/calc]
EOF

This is much simpler.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

If you think nobody cares if you're alive, try missing a couple of
car payments.  -- Earl Wilson