Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Allow all .minicpanrc params to be passed to CPAN::Mini->new() #2
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 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!