Problems with template toolkit and modperl

Scott Penrose scottp at
Sun Dec 7 17:34:56 CST 2003

Hash: SHA1

On Monday, Dec 8, 2003, at 10:24 Australia/Melbourne, Brad Bowman wrote:

>>> 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 had assumed Gerard was using TT2 - but are you ?

>>> 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.

Ahhh... so because it is blessed it assumes that it MUST be a method.
I was under the impression that it tried methods first and then hash.
So it should still work.

>> 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}"," ") -%]

Why ? HTML doesn't care ? Spaces make it easier to read :-)

That being said of course, I do remove spaces for non debug documents 

BTW. You can use 'FILTER' instead of doing it inline like above.
That way you don't have to add '-' to each of your lines - this makes 
the Template a little more readable, and doesn't matter if you forget 
the '-'

- -- 
Scott Penrose
VP in charge of Pancakes
scottp at

Dismaimer: If you receive this email in error - please eat it 
immediately to prevent it from falling into the wrong hands.

Please do not send me Word or PowerPoint attachments.
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see


More information about the Melbourne-pm mailing list