Thanks Josh! I appreciate any feedback, be it an inquiry for more details,
solutions, or just comments.
That IS my problem :-) I am writing a Perl Framework that I want to eventually
do open-source (it will tie in with my CPAN "OOP" module). I'm building my
website at www.perlscript.com using this framework - development is slow moving
because I want to think the whole framework through to make it as flexible to
develop in as well as have simplicity at the forefront when designing this -
not to mention I'm the only one working on it right now on my spare time. I
intentionally have made it public so curious eyes can witness the gradual
"birth" of an online community in the spirit of Open Source :-) This is to give
you a background what I need this for.
One of the issues in the framework's template parsing module is that it has to
parse the template, extract all the tags, and depending on what tags it finds,
it should execute corresponding code to that tag.
I have an alternative solution that requires me to "prototype" the desired
tags before process()ing the template, but I'd rather have it to where this is
not necessary. I'd rather be able to tap into a collection of all parsed tags,
and loop through them, and do with them what I want, when I want, how I want.
It wouldn't be hard to implement at all (in Parser.pm where the tag is parsed
I'd just store it in a property of $context or $stash, that could be accessible
from the outside) but the problem is that it would need to be part of the
distribution so I could tell the user of the framework "you need the latest
version of TT" rather than "you need to patch up your version of TT with this
hack".
To reiterate my example:
[% TAG %] is a [% TYPE %] that can be [% WORD %]
If I don't pass any vars to process(), there should be a collection, property,
or method I could call that would work something like:
$template->process(....);
@all_tags = $template->tags();
Does this make more sense?
Milan
> Date: Mon, 30 Jun 2008 10:23:45 -0600> From: [EMAIL PROTECTED]> To: [EMAIL
> PROTECTED]> CC: [email protected]> Subject: Re: [Templates] how
> do I find all parsed tags?> > Blue Eyed Devil wrote:> [SNIP]> > Example:> >
> > > [% BOY %] says [% WORD %] to [% GIRL %]> > > > Let's say I pass in the
> vars, BOY and WORD to $template->process() but > > NOT the var GIRL.
> However, I would like to have the ability to do > > something like:> > > >
> @tags = $template->some_method();> > > > And when I would go through the
> @tags it would contain ('BOY', 'WORD', > > 'GIRL').> > > > Logically it
> should be called after $template->process() to be able to > > get all tags.>
> > > > Any ideas on how to implement this with TT without any hacking?> > I'm
> pretty sure you'd have to hack this. It might be easier to give us your
> problem and ask for any ideas on how to solve it in a different manner than
> what you are doing.> > -- Josh
_________________________________________________________________
Need to know now? Get instant answers with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates