perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Vanasco <>
Subject Petal & ModPerl - PreCaching
Date Wed, 22 Mar 2006 21:06:11 GMT

I submitted a patch a few weeks ago that should be in the next  
upgrade to petal, though I don't know when that will be .

I should have cc'd this list when i did.  Some of you might find it  
useful - its a quick & dirty hack that will let you pre-cache petal  
templates during

it ended up saving me A TON in performance, by moving all of the  
templates into shared memory

it adds 'cache_only => 1' as an option to the constructor, which  
bypasses the error caused by an invalid datasource and returns true.   
( imho, settings cache_only is better than regexing an eval error  
message to figure out if you can ignore it or not )

i use it as such:

	my 	@template_files ;
	use File::Find;
	find(\&wanted, ( $Config::ServerLayout::TemplateDir ) );
     sub wanted { ... }
     foreach my $template ( @template_files ){
		my	$template = Petal->new( file 	=> $file, base_dir =>  
'/',cache_only => 1,);

the patch below has code only, i can't find the docs i wrote.  but it  
doesn't change anything other than adding that bypass argument.

View raw message