I have a custom global, <%myglobal%> in a template.
The global is a Perl subroutine.
I would like to call the global in several places within the template but only certain portions of the subroutine code to be executed depending on either a variable being passed in on the template or setting/unsetting a variable accessible in that template.
E.g. <%myglobal('region1')%> or <%myglobal('region2')%>
sub {
if 'region1'
do this
else if 'region2'
}
The idea is to reuse a subroutine that has some common code within the same template, the problem is I need to pass in an indicator from the template that can be used in that subroutine as a switch-on variable.
Any help would be appreciated.
The global is a Perl subroutine.
I would like to call the global in several places within the template but only certain portions of the subroutine code to be executed depending on either a variable being passed in on the template or setting/unsetting a variable accessible in that template.
E.g. <%myglobal('region1')%> or <%myglobal('region2')%>
sub {
if 'region1'
do this
else if 'region2'
}
The idea is to reuse a subroutine that has some common code within the same template, the problem is I need to pass in an indicator from the template that can be used in that subroutine as a switch-on variable.
Any help would be appreciated.