Bill Cowan <[EMAIL PROTECTED]> said something to this effect on 10/24/2001:
> Has anyone else tried to use TT2 to generate perl data structure,
> functions or whole programs?
> 
> Perhaps, share any general comments/thoughts? Gotchas?

Since perl code is just text, there's no reason you couldn't use
TT to generate perl.  You could even use TT to generate code that
gets executed immediately, something like:

  use Template;
  my $t = Template->new;
  my $code;

  $t->process(\q|sub foo { print "foo"; }|, {}, \$code)
      or die $t->error;

  eval $code;
  die $@ if $@;

  foo();

which works with perl 5.00503 and TT 2.0 (and also, I discovered
by accident, TT 1.07).

(darren)

-- 
Words, like eyeglasses, obscure everything they do not make clear.
    -- Joseph Joubert 


Reply via email to