Skip Menu |

This queue is for tickets about the MooseX-ConfigFromFile CPAN distribution.

Report information
The Basics
Id: 79746
Status: resolved
Priority: 0/
Queue: MooseX-ConfigFromFile

People
Owner: ether [...] cpan.org
Requestors: REHSACK [...] cpan.org
Cc:
AdminCc:

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



Subject: Allow roles providing config file defaults
Hi, with those little patch it's much easier to provide a role to find configfiles (using File::ConfigDir) or choose a proper location (using Sys::Path) or choosing one based on environment variables etc. When writing a suite using MX::App::Cmd otherwise you always have to copy'n'paste code into a common base class for suite's command classes doing the same thing (see for example http://paste.scsys.co.uk/207922). Thanks in advance, Jens
Subject: patch-MooseX-ConfigFromFile.default_in_role

Message body not shown because it is not plain text.

Applied to my local devel area and detected tests fail - better patch (from my PoV)
Subject: patch-aa
Download patch-aa
application/octet-stream 718b

Message body not shown because it is not plain text.

On Wed Sep 19 03:49:42 2012, REHSACK wrote: Show quoted text
> Applied to my local devel area and detected tests fail - better patch > (from my PoV)
paste.scsys.co.uk pastes expire after a month - can you include this content in your reply directly?
On Thu Oct 04 13:59:22 2012, ETHER wrote: Show quoted text
> On Wed Sep 19 03:49:42 2012, REHSACK wrote:
> > Applied to my local devel area and detected tests fail - better patch > > (from my PoV)
> > paste.scsys.co.uk pastes expire after a month - can you include this > content in your reply directly?
The patches are attached (patch-aa). The examples are unfortunately gone - the only things I could send you in a private copy are the code I made from it. I'm at the moment not allowed to publish the entire code - but will at a later stage.
On Wed Sep 19 03:39:58 2012, REHSACK wrote: Show quoted text
> When writing a suite using MX::App::Cmd otherwise you always have to > copy'n'paste code into a common base class for suite's command classes > doing the same thing (see for example http://paste.scsys.co.uk/207922).
You don't need to do that - you can just do: has '+configfile' => ( default => ... whatever you want... ); in either the consuming class. I do this in my $work code. However, using a method is cleaner, and would also let you set overrides from a role. Your patch would break the predicate (as the attr would always be set, to undef if nothing else), but I've got something working... I should be able to push it up shortly, probably as a TRIAL to ensure that nothing else is broken.
On Sat Feb 02 16:14:01 2013, ETHER wrote: Show quoted text
> Your patch would break the predicate (as the attr would always be set, > to undef if nothing else), but I've got something working... I should be > able to push it up shortly, probably as a TRIAL to ensure that nothing > else is broken.
This is available for eyeballs at the topic/get_default_configfile_method branch on gitmo. However, it turns out that it isn't really necessary, as there already was a way to set a configfile value (and it was documented! except not very clearly, and also incorrectly). I'll be releasing a doc amendment imminently. I'll leave this ticket open for now, but please see if the current mechanism is sufficient.
Well, please provide example code how to define config file defaults from a role which imports MX::ConfigFromFile (to satisfy MX::App::Cmd interaction). IMHO there is a big difference from doing changes in instances and changes in derived roles.
On Sun Feb 03 00:38:39 2013, REHSACK wrote: Show quoted text
> Well, please provide example code how to define config file defaults > from a role which imports > MX::ConfigFromFile (to satisfy MX::App::Cmd interaction). > > IMHO there is a big difference from doing changes in instances and > changes in derived roles.
rehsack: package MyRole; use Moose::Role; with 'MooseX::SimpleConfig'; around configfile => sub { 'my/configfile/default' }; However, while fixing some other issues in MooseX::Getopt this week, I wrote some more MXCFF compatibility tests, and found that this mechanism doesn't play well with MooseX::Getopt.. so I'll be finishing up that other branch and implementing what you requested in the first place. It should be ready by the weekend (please harass me if it is not).
version 0.08 adds this feature.