Re: cpan commandline script
  Home FAQ Contact Sign in
perl.cpan.workers only
 
Advanced search
POPULAR GROUPS

more...

perl.cpan.workers Profile…
 Up
Re: cpan commandline script         


Author: David Golden
Date: Sep 17, 2008 13:40

On Wed, Sep 17, 2008 at 4:24 PM, brian d foy cpan.org> wrote:
> David Golden is one of the CPAN.pm maintainers, so he might be
> interested in this discussion too. David, is there a CPAN.pm
> developers mailing list this should be on?

Sort of. In Oslo, various people said we should reactivate
cpan-workers@perl.org for discussions about how to move the CPAN tools
and ecosystem forward. So I and some other have subscribed but
there's been not much traffic. But come join! We can start it up.

I like the idea. My personal wishlist for CPAN.pm is to eventually
eliminate all the globals and global file locking so multiple CPAN's
can run concurrently. Then multiple config files become potentially
even more useful.

-- David
1 Comment
Re: cpan commandline script         


Author: Brian D Foy
Date: Sep 17, 2008 18:52

To bring everyone up to speed, someone asked me to modify the cpan
script so it would load a one-time use configuration file.

That's a bit difficult to do inside CPAN.pm because the module is
hard-coded to look for CPAN/MyConfig.pm in @INC (and it shoves ~/.cpan
in there for you).

The use case looks like:

prompt$ cpan -j MyConfig.pl .....


Inside MyConfig.pl, you do something that populates $CPAN::Config when
it loads. It's possible to do that not when it loads, but the easiest
thing is to just take a file in the right format. $CPAN::Config is a
global variable, and that's just the way it is, so I'm leaving all of
that complexity in whatever MyConfig.pl is.

Now comes the tricky part. CPAN.pm has several entry points, and they
first check that the config was loaded before they do their thing.
CPAN::HandleConfig->load (formerly CPAN::Config->load) checks that
$CPAN_loaded is true. If it's not, it calls require_myconfig_or_config,
which looks in %%INC for $INC{'CPAN/MyConfig.pm'}.
Show full article (1.71Kb)
no comments