[Templates] properly accessing variables and content processing with TT2

[prev] [thread] [next] [Date index for 2004/08/23]

From: erob
Subject: [Templates] properly accessing variables and content processing with TT2
Date: 18:27 on 23 Aug 2004
Hi,

	I am getting into some troubles designing a web-site 
	with the very efficient template toolkit and with mod_perl. 

	For the sake of simplicity, I created a main template, called
	"main-perl.tt" which is simply a big [% RAWPERL %] ... [% END %]
	directive. That template was expected to deserves raw content
	which require further processing. Everything is fine at that point;
	the $stash variable can even get/set variables accordingly. 

	However, for some reasons, handling exceptions of the following
	form does not gives back what I want :

		if ($stash->get('foo') { 
			$output .= "more foo";
			$output .= $context->process('foo.tt');
		}

		# XXX Cannot get 'blurb' because 'foo' still exists..
		elsif ($stash->get('blurb') { 
			$output .= "more foo"; 
		}
		...
	
	So I'm pretty much without clues at this point, whether I 
	need $stash->undefined or roll my own $stash->delete method.

	Perhaps a DESTROY subroutine may help as this point, something
	like:
			sub DESTROY {
				my($var) = shift;
				undef $var;
			}


	TIA,

	erob

	

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

[Templates] properly accessing variables and content processing with TT2
erob 18:27 on 23 Aug 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52