[ic] My subroutine conflicts with Interchanges subroutine.

Peter peter at pajamian.dhs.org
Thu Sep 24 00:31:51 UTC 2009


On 09/23/2009 11:19 AM, Bill Carr wrote:
> Running Interchange 5.6.1.
> 
> I had a UserTag like so:
> 
> UserTag ship_cost Routine <<EOR
> sub {
> 	...some code, blah blah, blah...
> 
> 	sub apply_discount {
> 		
> 		...some more code...
> 	}
> }
> EOR
> 
> My usertag was invoked on the same page that IC's subtotal tag was  
> invoked. My sub apply_discount was being called instead of IC's  
> Interpolate::apply_discount from Interpolate::subtotal.
> 
> Should I be able to make UserTags that have subroutines of the same  
> name as Interchange's subroutines? Who's screwing up here? Me,  
> Interchange or both.
> 
> This was a nasty problem for me as a change I made to a single catalog  
> caused no subtotal to be displayed on some 80+ sites.

You discovered an Interchange feature quite by accident, what you're
doing is essentially the same thing as this:
<http://www.icdevgroup.org/interchange-doc-5.2.0/frames/icprogrammer_7.html>

If you want a sub to be localized to the usertag then you can do
something like this instead:

my $apply_discount = sub {
	...some more code...
}


...
# Call the sub
$apply_discount->();


Peter



More information about the interchange-users mailing list