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

Steve Purkis spurkis at mkdoc.com
Thu Jun 5 16:40:57 BST 2003


On Thursday, June 5, 2003, at 03:24  pm, Jean-Michel Hiver wrote:

>> 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.

Hmm..  silly me.  you're quite right.  Just don't forget those locals() 
...

-Steve



More information about the Petal mailing list