At Fri, 26 Apr 2002 10:23:51 +0100 (BST), Mark Fowler wrote: > I did some similar work on this quite a while back (looking at my file > system, December 2001.) I was waiting for ingy to make some changes to > Inline to allow options to be passed directly to the load method so that I > could specify things like: > > Inline 'Template' => INCLUDE_DIR => "/my/inc/dir"
Ah, completely missed that. Sorry for the duplicate effort. I just uploaded Inline::TT onto CPAN few minutes ago. Maybe we should co-work for it now. # And Inline::TT should be named Inline::Template? but IMO # 'Inline::Template' is too generic (it reminds me of another usage), # despite the fact that TT itself is named 'use Template;' ;) > I make some attempt to localise the varibles > that are passed as arguments by hand so that you could have things like > counters in the templates that still work (and don't get knobbled by TT's > own localisation) I use include() of TT, which localizes variables magically, if I understand Andy's code correctly ;) > e.g. (from the tests) > > # can we pass arguments > is(echo(text => "foo"),"foo", "parameter passing"); > > # should not see "foo" now > is(echo(),"","stash localisation"); > > # check the counter > counter(); > is(counter(),"2","variable passing"); > > __END__ > > __Template__ > > [% BLOCK echo %][% text %][% END %] > [% BLOCK counter %][% n = n + 1 %][% n %][% END %] Okay, I tried with it, here's the result: use Inline 'TT'; # can we pass arguments is(echo(text => "foo"),"foo", "parameter passing"); # should not see "foo" now is(echo(),"","stash localisation"); # check the counter counter(); is(counter(),"2","variable passing"); __END__ __TT__ [% BLOCK echo %][% text %][% END %] [% BLOCK counter %][% n = n + 1 %][% n %][% END %] ok 1 - parameter passing ok 2 - stash localisation not ok 3 - variable passing # Failed test (- at line 10) # got: '1' # expected: '2' 1..3 # Looks like you failed 1 tests of 3. -- Tatsuhiko Miyagawa <[EMAIL PROTECTED]>
