[Catalyst] Problem with Catalyst::View::HTML::Template + config file

Luis E. Muñoz luisemunoz at gmail.com
Sat Aug 25 17:11:06 GMT 2007


Hi Folks

I've been trying to use a configuration file to set parameters in the  
HTML::Template view of my Catalyst app, to no avail. (Specifically,  
setting die_on_bad_params => 0).

No matter what I put in the config file, this does not work. This is  
an approximation to my app:

Grok::App
        \- lib
            \- Grok
               \- App
                  \- V
                     \- HT.pm

My .yaml config contains:

name: Grok::App
$module:
   die_on_bad_params: 0

(I saw the comments on #catalyst about the negative pressure of YAML,  
but this issue happens with other styles of config file too)

Where $module has been (V|View)::HT, Grok::App::(V|View)::HT and  
countless other permutations, with no results. The config entries  
show up in $c->config->{$module} as expected. I can verify this in  
the error window that I get when accessing the app through a browser.

Taking a look at Catalyst::View::HTML::Template, I see the code that  
gathers the configuration entries in there is different from other  
View::* modules. Specifically, it shows

     my $template = HTML::Template->new( %options, %{ $self->config } );

But in my tests, %{$self->config} is an empty hash. If I replace the  
above code with

     my $template = HTML::Template->new(%{$self->merge_config_hashes
                ( \%options, $c->config->{ref $self} )});

Then the settings get included in the call to ->new() and I can  
actually configure the template properly. However, this still does  
not match the (very few) examples I've been able to find, because I  
have to write:

name: Grok::App
Grok::App::V::HT:
   die_on_bad_params: 0

My interpretation of the docs I've seen, is that I should be able to  
write

name: Grok::App
V::HT:
   die_on_bad_params: 0

So, what am I doing wrong? What's missing?

Regards

-lem




More information about the Catalyst mailing list