text::template - 'here document' << query

Sean O'Riordain seanpor at acm.org
Thu Aug 21 03:24:34 CDT 2003


Thank you Simon!

My working solution is...

[@-- if ($affiliate eq "b1") {
     $OUT .= qq|<Script Language="JavaScript">
     <!--//Begin
etc...
     </Script>|
}
  --@]

Thanks again Simon,
Sean


Sean O'Riordain wrote:
> I'm using Text::Template for a cgi application, where the templates are 
> html with little bits of perl...
> 
> I want to include a bit of javascript conditionally, within the 
> template... something along the lines of...
> 
> [@-- if ($affiliate eq "b1") {
> print <<EOM;
> ... javascript here...
> EOM
> } --@]
> 
> where affiliate is passed in as a key in a hash... and this is fine... 
> it has the correct value etc...
> 
> ... but this snippet doesn't work... I just get a "1" (true? - because 
> affiliate does eq "b1"... ) but i want it to print the javascript not 
> the result of the 'if' :-)





More information about the Belfast-pm mailing list