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 );

};



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


_______________________________________________
List: Catalyst@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/

Reply via email to