Hello.

I'm writing CGI::Builder::TT2 [1], an integration module for
TT2 and CGI::Builder. I'm studying how to implement a lookup
mechanism similar to that implemented in CGI::Builder::Magic,
which I'm using as a model.

Here a small example of what I'd like to obtain:

  ----
  package My::Package ;

  our $my_scalar  = 'a scalar value' ;
  our %my_hash = ( key=> 'value' ) ;
  sub my_sub { ... }

package My::App;

  # ... the main app uses CGI::Builder and CGI::Builder::TT2,
  # which knows about My::Package and knows that it has
  # to use that package for lookups
  ----

Then, in the template:

  ----
  Hello world, here [% my_scalar %] ...
  and so on and so forth...
  ----

that leads to:

  ----
  Hello world, here a scalar value ...
  and so on and so forth...
  ----

My questions are:

 i. This mechanism is native in Template::Magic, so it was
    natural to implement it in CGI::Builder::Magic too.
    I don't know anything similar in TT. Does anyone?

ii. How would you implement this mechanism with the Template
    Toolkit? (I guess I have to make a subclass of
    Template::Stash)

thank you,
S.

[1] What about this name?
[2] http://search.cpan.org/~domizio/CGI-Builder-Magic-1.22/lib/CGI/Builder/ Magic.pm#Lookups


--
Stefano Rodighiero      |  http://larsen.perlmonk.org
mailto:[EMAIL PROTECTED]   |  http://www.perl.it


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

Reply via email to