Problems with template toolkit and modperl

Brad Bowman bsb at
Sun Dec 7 17:24:44 CST 2003

> > Now, outside of mod_perl, just using a normal perl script using
> > the same template as I use in the mod_perl module, I can get this 
> > working.
> > Within mod_perl, it will not work!

Does you test script use TT2?

> > I have narrowed it down to that fact that if I unbless the 'windows' 
> > objects
> > in the code below, it gives me the desired results, but this is 
> > inefficient
> > so I'd like it to be working properly!

It's b/c TT2 has the magic dot.  hash.key gives you the
element while object.method calls the method and gives
you the result.  In your case Some::Object needs a
"buttons" accessor method.

> However I do have one suggestion which will help you debug it... Use 
> Data Dumper in Template Toolkit.
> [% USE Dumper %]
> [% Dumper.dump_html(windows) %]

Less spaces: 

[%- USE dumper(Indent=2,Varname='VAR') -%]
[%- MACRO dump(this) dumper.dump(this) | html | replace(" {4}"," ") -%]

An affected laugh shows lack of self-respect in a man and lewdness in a woman.
                                      -- Hagakure

More information about the Melbourne-pm mailing list