[Petal] dynamic includes

Josh Narins josh at narins.net
Wed Feb 9 15:45:09 GMT 2005


I've copied Mr. Smiths' code below, I used it as is.

William, to make a suggestion, I'd probably want to see one of the
peices of code.  Also, there are some modules which are much larger
resources hogs than others.  CGI.pm and IO::* are among them.

Maybe it'd just be best to write any future modules in mod_perl...

> You need to build an include: modifier. Name this Include.pm and put it
> in your perl path under Petal/Hash
> 
> package Petal::Hash::Include;
> 
> use strict;
> use warnings;
> 
> use base qw/Petal::Hash::String/;
> 
> sub process {
>     my ($self, $hash, $args) = @_;
> 
>     my $fn = $self->SUPER::process($hash, $args);
>     my $tpl = Petal->new($fn);
>     return $tpl->process($hash);
> }
> 
> 1;
> 
> 
> you can then do things like
> 
> <tag petal:replace="structure include: ${extra_content}" />
> 
> Where extra_content is a file that needs to be parsed.
> 
> /me wonders why this was never added to Petal...
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.webarch.co.uk/pipermail/petal/attachments/20050209/eac58766/attachment.bin


More information about the Petal mailing list