[Petal] petal include: modifier

Fergal Daly fergal at esatclear.ie
Fri Jan 14 17:55:58 GMT 2005


On Fri, Jan 14, 2005 at 12:32:42PM -0500, William McKee wrote:
> On Thu, Jan 13, 2005 at 07:06:18PM -0500, Josh Narins wrote:
> > I remember this solution before.
> > 
> > Doesn't it result in a double petal process'ing of the whole document?
> > 
> > If not, I'm sorry for not understanding before.
> 
> Good question. If we knew everything, there'd be no need for mailing
> lists :). In this case, I don't see how this code would result in the
> whole document being processed twice. However, it may result in the
> included document getting processed twice.
> 
> Hopefully Fergal, who is much more familiar with Petal's internals, can
> give us his insight. Off the top of my head, I'm not sure what harm
> would result from Petal doublely processing a file but suspect it may
> get weird.

I don't see why it would process the original file a second time

sub process {
    my ($self, $hash, $args) = @_;

    my $fn = $self->SUPER::process($hash, $args);
    my $tpl = Petal->new($fn);
    return $tpl->process($hash);
}

the first ->process just finds the name of the included file, ->new loads it
and the second ->process processes the included file.

Fergal


More information about the Petal mailing list