Problems with template toolkit and modperl

Gerard gerard at
Tue Dec 9 08:01:36 CST 2003

Hi everyone,

        I am experiencing some troubles with Template Toolkit+mod_perl and was
wondering if anyone had seen this behavior and knows how to fix it.

Within a mod_perl handler{}, I am calling a new Template and processing some
object data.  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!

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!

This is what the data structure looks like:

my $data = {
          'windows' => [
                            bless( {
                                     'name' => 'blah',
                                     'buttons' => [
                                                      'name' => 'frank',
                                                      'image' => 'whatever'
                                     'foo' => 'bar',
                                   }, 'Some::Object' ),
                            bless( {
                                     'name' => 'blah2',
                                     'foo' => 'bar2'
                                   }, 'Some::Object' ),

Here is the template code:

[% FOREACH window = windows %]
        [% FOREACH button = window.buttons %]
                [% %]
                [% button.image %]
        [% END %]
	[% %]
[% END %]

This should give me:

But I only get:

It refuses to access to buttons entry.

My test script outside of mod_perl gives me the correct result.

Any ideas?


More information about the Melbourne-pm mailing list