Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

To give fieldvalues to subroutines (not template!)

Quote Reply
To give fieldvalues to subroutines (not template!)
I have always the same problem by modifying the last days:
I call fom build.cgi one sub in HTML_Templeates;
I know that every field from the table is given to the subroutine, but i dont knwo how to give it out as variable in the subroutine (not in the template!)

Example:

build.cgi calls
Code:
sub site_html_print_cat
There i want to say :
my $NewVar = Value of Field Description.

Hope someone have an answer this night, i stuck without this.
Robert



Quote Reply
Re: To give fieldvalues to subroutines (not template!) In reply to
You would pass it the same way, by adding it to the $rec-> hash. Then, picking it out in the subroutine.

To do it any other way, would require you to re-write the arguments to the subroutine.

You are better adding to to the $rec-> hash, than to %GLOBALS, since you'd have to keep track of what you are doing if you do that.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/