Title: RE: [Templates] Template::Plugin::XML::Writer

From: Perrin Harkins Sent: Tue 7/11/2006 6:36 PM
> On Tue, 2006-07-11 at 18:25 +0100, Addison, Mark wrote:
> > We have an export system and presentation layer built
> > around TT for output generation (multiple formats, not
> > just XML). I didn't want to enable PERL blocks in the
> > templates or change the exporter code adding an extra
> > path to pass a script instead of a template for output
> > generation (which would still expose Perl going in).
>
> I don't mean to pick on you,

I'm game ;-)

> but I do see several problems with this approach:
> - It's not a template.

I what sense? The example was pretty contrived but how I
actually use it is to pass in a bunch of vars to substitute
into the XML. Seems like a template to me.
What about something like:

 [% xw = XML.Writer %]
 <html>
   <head>
     <title>[% doc.title | html %]</title>
     [% FOREACH name IN doc.meta.keys ;
          xw.emptyTag('meta', name=>name, content=>doc.meta.$name);
        END; %]
   </head>
   <body>

> - It doesn't get the syntax checking that perl code normally would.

Of course, it gets the syntax checking that templates normally do.
The main issue I see here is calling non-existant methods doesn't
error, but you get this with passed in objects in vars as much as
plugins. (I'd like a safe option that caused a template error
if you called a missing method.)

> - It can't be debugged or profiled in the normal ways.

In the normal ways you do with templates.
Whats stopping you profilling TT code?
(I'm pobably luck in never really having performace problems
with templates.)

> - It's a low slower than it needs to be.

Depends how fast it needs to be. Hard to say without
some profilling. Templates complile down to a perl script
so it's not much different, apart from some extra calls
due to the plugin wrapping. My main objective was to get
XML::Writer functionality, not performance.
It seems to perform as well as more traditional XML
generating templates for my needs.

> But then I'm against the DBI plugin too, so it's safe to say I'm in the
> minority.

:) I'm probably with you on that one, the DBI plugin
definatley makes me uneasy.

You snipped the bit about non-perl coders. Do you not think
XML::Writer could be useful functionality to expose to
Template coders?

cheers,
mark
--


 
MARK ADDISON
WEB DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4678
F
E [EMAIL PROTECTED]
WWW.ITN.CO.UK

Please Note:

 

Any views or opinions are solely those of the author and do not necessarily represent 
those of Independent Television News Limited unless specifically stated. 
This email and any files attached are confidential and intended solely for the use of the individual
or entity to which they are addressed. 
If you have received this email in error, please notify [EMAIL PROTECTED] 

Please note that to ensure regulatory compliance and for the protection of our clients and business,
we may monitor and read messages sent to and from our systems.

Thank You.

Reply via email to