Skip Menu |

This queue is for tickets about the Catalyst-Plugin-ConfigLoader CPAN distribution.

Report information
The Basics
Id: 31498
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-ConfigLoader

People
Owner: bricas [...] cpan.org
Requestors: jonh [...] nmgi.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Load config files in alphanumeric order
This is a simple patch to sort config files alphanumerically before loading them, to allow intentional ordering of config files, such that overrides can be more useful, particularly in a development environment. For example: myapp.conf myapp_10_devel.conf myapp_20_experimental.conf myapp_local.conf
Subject: CL.patch
--- /usr/share/perl5/Catalyst/Plugin/ConfigLoader.pm 2007-11-21 12:53:05.000000000 -0600 +++ ConfigLoader.pm 2007-12-13 13:23:46.000000000 -0600 @@ -73,7 +73,7 @@ # load all the normal cfgs, then the local cfgs last so they can override # normal cfgs - $c->load_config( $_ ) for @cfg, @localcfg; + $c->load_config( $_ ) for (reverse sort @cfg), (reverse sort @localcfg); $c->finalize_config; $c->NEXT::setup( @_ );
From: jonh [...] nmgi.com
This patch properly sorts the keys of each element of @cfg and @localcfg, rather than sorting the hashrefs themselves.
--- /root/ConfigLoader.pm 2007-12-13 14:17:19.000000000 -0600 +++ ./ConfigLoader.pm 2007-12-13 14:29:24.000000000 -0600 @@ -73,7 +73,8 @@ # load all the normal cfgs, then the local cfgs last so they can override # normal cfgs - $c->load_config( $_ ) for @cfg, @localcfg; + $c->load_config( $_ ) for ( sort { ( keys %$a )[ 0 ] cmp ( keys %$b )[ 0 ] } @cfg ), + ( sort { ( keys %$a )[ 0 ] cmp ( keys %$b )[ 0 ] } @localcfg ); $c->finalize_config; $c->NEXT::setup( @_ );
On Thu Dec 13 15:30:29 2007, jonh wrote: Show quoted text
> This patch properly sorts the keys of each element of @cfg and > @localcfg, rather than sorting the hashrefs themselves.
A tentative patch (slightly different than what you've supplied) has been checked into the repository at revision 7437 [1]. Please check it out [2] and test it. -Brian [1] http://dev.catalyst.perl.org/svnweb/Catalyst/revision/?rev=7437 [2] http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Plugin-ConfigLoader/
Version 0.20 released to CPAN.