[ic] Catalog subroutines

Stefan Hornburg interchange-users@icdevgroup.org
Thu May 1 15:13:01 2003


On Thu, 1 May 2003 13:48:27 -0500
"Caleb Groom" <caleb@hhhenterprises.com> wrote:

> I'm trying to add a catalog subroutine according to the documentation
> in"26.94. Sub".  The example there a sort_cart_by_quantity function
> that builds a string and returns it.
> 
> For practice I'm taking the foundation catalog and adding the number
> of items in the cart to the upper right hand section of the page. 
> Here's my function as listed in catalog.cfg:
> 
> Sub <<EOF
> sub show_custom_cart {
>  my $out = sprintf("%d item%s", scalar @{$Carts->{main}}, scalar
> @{$Carts->{main}} == 1 ? "" : "s");
>  return $out;
> }
> EOF

Does that compile without error ?

> 
> I call it like so:
> 
> Your cart: [perl] return show_custom_cart(); [/perl]

Please try [perl subs=1] return show_custom_cart(); [/perl]

Ciao
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team