Subject: | Plugin config defaults overwrite user config |
&Catalyst::Plugin::Snippets::setup assigns several defaults to the
"snippets" config hash, but the list of default key/value pairs appear
in the assignment list _after_ the values from $app->config->{snippets},
overwriting any values supplied by the user's configuration files. This
makes it impossible to configure options like 'format' and etc.
The attached patch fixes the issue for me.
Sorry if this is bad form, but I though I'd also mention:
Looking at the tests I don't see any assignments to the config hash that
would exercise the code that serializes/deserializes JSON.
Also, the documentation mentions a method called serialize_snippet, but
it doesn't appear anywhere in the code.
Subject: | Catalyst-Plugin-Snippets-fix-config.patch |
--- /opt/perl/lib/site_perl/5.14.2/Catalyst/Plugin/Snippets.pm.orig 2012-01-20 17:55:44.000000000 -0600
+++ /opt/perl/lib/site_perl/5.14.2/Catalyst/Plugin/Snippets.pm 2012-01-20 17:55:54.000000000 -0600
@@ -15,12 +15,12 @@
my $ret = $app->maybe::next::method(@_);
%{ $app->config->{snippets} } = (
- %{ $app->config->{snippets} || {} },
format => "plain",
allow_refs => 1,
use_session_id => 0,
json_content_type => "application/javascript+json",
content_type => "text/plain",
+ %{ $app->config->{snippets} || {} },
);
$ret;