Allow all .minicpanrc params to be passed to CPAN::Mini->new() #2

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
@thaljef
Contributor

thaljef commented Jun 28, 2011

Hi Ricardo-

I'm working on a subclass of CPAN::Mini that will store the local mirror in an SCM repository. This subclass needs some extra configuration parameters (like the repository URL). I'd like to put these in the .minicpanrc file and reuse minicpan[1] as the front-end, but CPAN::Mini::App will only pass along a specific set of paramerters to the CPAN::Mini constructor.

My fork passes all the available config parameters to the CPAN::Mini constructor. This allows subclass authors to specify additional config file parameters for their subclass. I accomplished this by changing the way GetOptions is used, and by normalizing the names of the command-line switches to match those of the keys of the CPAN::Mini constructor. I also added aliases for several command-line switches to so the public interface still looks the same. Finally, all the command-line and configuration parameters are merged and passed to the CPAN::Mini constructor.

I admit this feels a bit hackish. But the goal seems honorable. I'm open to suggestions if you see a better way to go. BTW: I'd ultimately like to allow suclasses to extend the command-line with additional switches, but I haven't thought about that yet.

Thanks for the great work!

-Jeff

Jeffrey Ryan Thalhammer added some commits Jun 28, 2011

Jeffrey Thalhammer
Added test case for the -perl switch.
This was the one command-line switch that I had
to munge (into 'skip_perl') so that I could just
merge the hash of command-line parameters with the
hash of config-file parameters.
@rjbs

This comment has been minimized.

Show comment
Hide comment
@rjbs

rjbs Apr 13, 2013

Owner

I have pulled this into master. Thanks very much, and I sincerely apologize for the ridiculous delay in applying this. I have no excuse!

Owner

rjbs commented Apr 13, 2013

I have pulled this into master. Thanks very much, and I sincerely apologize for the ridiculous delay in applying this. I have no excuse!

@rjbs rjbs closed this Apr 13, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment