[Petal] [PATCH] Options via constructor rather than package globals

Jean-Michel Hiver jhiver at mkdoc.com
Thu Jun 5 16:24:30 BST 2003


> Not only not thread safe... consider:
> 
> 	my $tmpl1 = Petal->new( 'tmpl1.html', base_dir => '/foo' );
> 	my $tmpl2 = Petal->new( 'tmpl2.html', base_dir => '/tmp' );
> 	...
> 	$tmpl1->process();
> 	...
> 	$tmpl2->process();
> 
> 	# templates may come from both /tmp *and* /foo for $tmpl2...

Of course no, they would not. Since all the locals are declared within
the process() method, they'll be scoped inside process() and that's it.

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/


More information about the Petal mailing list