[Catalyst] New stable and development versions on CPAN
John Napiorkowski
jjn1056 at yahoo.com
Mon Dec 23 14:20:57 GMT 2013
On Sunday, December 22, 2013 10:58 PM, neil.lunn <neil at mylunn.id.au> wrote:
On 23/12/2013 3:40 AM, John Napiorkowski wrote:
> There's a lot of weirdness in how the ConfigLoader plugin works, and it causes a lot of hair pulling since it is a plugin and gets installed during the 'setup_plugins' phase. There's a couple of options, ranging from 'doing something else' to hacking a special case where if this plugin is seen it gets installed ASAP. Thoughts and discussion welcomed.
The approach I've favored for a while is remove ConfigLoader and setup
config via a custom class. Also allows loading config external of
Catalyst. Like so:
__PACKAGE__->config(
name => 'MyApp::FunnyIO::Web',
# Disable deprecated behavior needed by old applications
disable_component_resolution_regex_fallback => 1,
enable_catalyst_header => 1, # Send X-Catalyst header
%{ MyApp::FunnyIO::Config->config || {} }
);
Also just as a matter of current taste, I tend to inject "log" into the
$app instance from new:
builder {
my $app = MyApp::FunnyIO::Web->new;
$app->log(
Log::Log4perl::Catalyst->new(
$app->config->{log}, autoflush => 1
)
);
$app->apply_default_middlewares( $app->psgi_app );
};
---
Thanks Neil, I think a lot of people sometimes forget that the Catalyst object is really in the end just a class. --jnap
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
More information about the Catalyst
mailing list