<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>[Petal] petal include: modifier</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Is there any significant overhead associated with
this method?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Is it basically the same as doing a static metal
include? I suppose there must be some more overhead, an extra Petal->new
call, and an extra ->process() call too</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Simon</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>PS thanks for the code :)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=wsmith@platinumtel.com href="mailto:wsmith@platinumtel.com">Warren
Smith</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=petal@lists.webarch.co.uk
href="mailto:petal@lists.webarch.co.uk">Petal Mailing List</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, January 13, 2005 11:37
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Petal] petal include:
modifier</DIV>
<DIV><BR></DIV>
<P><FONT size=2>This is very simple, and allows you to do something like
this</FONT> </P>
<P><FONT size=2>given {</FONT> <BR>
<FONT size=2>template => 'content.html'</FONT> <BR><FONT size=2>}</FONT>
<BR><FONT size=2>you can do</FONT> </P>
<P><FONT size=2><html></FONT> <BR><FONT size=2><div
petal:content="structure include: ${template}" /></FONT> <BR><FONT
size=2></html></FONT> </P>
<P><FONT size=2>and content.html will be included in your main site.</FONT>
</P>
<P><FONT size=2>And as everybody knows, there is always more than one way to
do it, but</FONT> <BR><FONT size=2>this worked for me.</FONT> </P><BR>
<P><FONT size=2>package Petal::Hash::Include;</FONT> </P>
<P><FONT size=2>use strict;</FONT> <BR><FONT size=2>use warnings;</FONT> </P>
<P><FONT size=2>use base qw/Petal::Hash::String/;</FONT> </P>
<P><FONT size=2>sub process {</FONT> <BR><FONT size=2> my
($self, $hash, $args) = @_;</FONT> </P>
<P><FONT size=2> my $fn = $self->SUPER::process($hash,
$args);</FONT> <BR><FONT size=2> my $tpl =
Petal->new($fn);</FONT> <BR><FONT size=2> return
$tpl->process($hash);</FONT> <BR><FONT size=2>}</FONT> </P>
<P><FONT size=2>1;</FONT> </P><BR></BLOCKQUOTE></BODY></HTML>