[Petal] Help ? Trying to pre-cache

Jonathan Vanasco petal-list at 2xlp.com
Fri Feb 17 02:41:41 GMT 2006


I'm running petal under mod perl

i'm trying to pre-cache the Petal templates before Apache forks, so i  
can use the Petal memory cache.

my issue is this:
	
	petal has the fatal error "Cannot find value for ... (FATAL)"

based on the petal intenral chart:
     1. Read the source XML template
     2. $INPUT (XML or HTML) throws XML events from the source file
     3. $OUTPUT (XML or HTML) uses these XML events to canonicalize  
the template
     4. Petal::CodeGenerator turns the canonical template into Perl code
     5. Petal::Cache::Disk caches the Perl code on disk
     6. Petal turns the perl code into a subroutine
     7. Petal::Cache::Memory caches the subroutine in memory
     8. Petal executes the subroutine
     9. (optional) Petal internationalizes the resulting output.

I need to stick something between 7&8 to return true.  can anyone  
point me to a line in Petal where that about happens?

i figure some sort of option in the constructor, when set, could  
bypass that.  i'd be happy to try and write the patch for that - i  
just can't figure out where to start.

i tried using the function
	perl -MPetal -e code template.xml
but that doesn't work, as it doesn't do the caching or subroutine  
creating

any help would be greatly appreciated


==

fyi, the recusion i use to get the template files is such:

	my 	@template_files ;
	use File::Find;
	find(\&wanted, ( $templateDir) );
     sub wanted
     {
     	my %pathname = map { $_ , 1 } split '/' , $File::Find::name;
		
		# kill the subversion files
     	return if ( $pathname{'.svn'} );

		# kill the subversion files
		return unless ( substr( $_ , -5 ) eq '.html' );

		push @template_files , $File::Find::name;
     }

	foreach my $file ( @template_files )
	{
		my	$template = Petal->new
		(
			file 	=> $file,
			'base_dir' => '/'
		);
		$template->process();
	}


More information about the Petal mailing list