>>>>> "Robin" == Robin Smidsrød <[EMAIL PROTECTED]> writes:

Robin> But my next question is then, how can I go about to set this variable
Robin> automatically when $tt->process() is called? This way I don't have to
Robin> change the many occurences of $tt->process() in my code. Are there some
Robin> variable in the tt init code which could be set to a callback which is
Robin> automatically run whenever I execute $tt->process?

BEGIN {
  package My::Template;
  use base qw(Template);

  sub process {
    my ($self) = @_;  # don't shift, because we goto...

    local $RUNNING = 1; # check $My::Template::RUNNING now
    my $super = $self->can("SUPER::process") or die "$self can't process";
    goto &$super;

  }
}

my $tt = My::Template->new(...);
$tt->process(...);

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to