Subject: | Error getting the configuration hash from Catalyst |
Date: | Sat, 18 Jun 2011 20:56:37 +0200 |
To: | bug-Catalyst-View-Excel-Template-Plus [...] rt.cpan.org |
From: | Jorge Gonzalez <j.g.villalonga [...] gmail.com> |
Hi,
when creating a view with new, it gets its config in this way:
my $config = $c->config->{'View::Excel::Template::Plus'};
(Catalyst/View/Excel/Template/Plus.pm, line 27)
When creating a view of this class in a Catalyst app, this code works as
long as you name your view exactly "View::Excel::Template::Plus" (which may
or may not be what you want). My view is named just "View::Excel", and so I
can'tt config the view properly following standard Catalyst procedure.
This module should get the config data not from the global configuration and
then the hardcoded view type (as it is now), but the runtime name of the
view class, this way:
my $config = { %{$class->config} };
In this way, if I decide to create a view named "MyView", which inherits
from Catalyst::View::Excel::Template::Plus, the configuration will be read
from $c->config->{'View::MyView'} and not from the wrong place.
I have manually corrected this issue in my app and everything works as
expected.
Thanks for such a good module.
Regards
Jorge