Thanks! I don't think this is suitable for what I have in mind as it wouldn't
let me get the directive being processed.
What I have in mind is something like...
Today's date is [% DATE %]
Normally I would have to say
$template->process($template, { DATE => $obj->date() }, ...);
For it to say Today's date is 06/30/2008.
What I want to be able to do is:
$template->process($template, {}, ...);
As you can notice, process() gets no $vars passed, so it has no clue what tags
to look for.
From inside the process() I would call:
@all_tags = $template->tags();
Inside process() (by way of override) I could then have a hook that does
something like this (expanded code for clarity - no error handling/checking):
foreach $tag (@all_tags)
{
$tagObject = new $tag;
$output .= $tagObject->run();
}
return $output;
Heck, if I really want to be greedy, I'd even ask for the processing code to
be a parameter that you could be passed so we could specify custom code for
tags so we wouldn't even have to override anything.
I might be the only person who'd like it. Tho my example is simple, there
could be potentially many other uses for it (as with anything else).
Milan
> Date: Mon, 30 Jun 2008 12:32:17 -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]> > 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 > > <http://www.perlscript.com> using this
> framework - development is slow > [SNIP] > > 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.> > Do you have a real world
> example of this happening? (ie. I need to do X when tag Y is found.) I'm not
> really fully understanding what you are doing, but an example might help.
> Someone with actual framework experience here may be able to help you more.>
> > Would the TAG_STYLE config option help (see following link) if you are
> doing preprocessing? (Process with one tag style and then reprocess with
> another.):>
> http://template-toolkit.org/docs/manual/Config.html#section_TAG_STYLE> > --
> Josh> > [SNIP]
_________________________________________________________________
Introducing Live Search cashback . It's search that pays you back!
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=introsrchcashback_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates