FAQ

On Wed, Sep 17, 2008 at 4:24 PM, brian d foy 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

Search Discussions

  • Brian d foy at Sep 18, 2008 at 1:53 am
    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 .....

    <braindump reason="history">
    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'}.
    </braindump>

    Now, if I want to load configs, I might as well dump them too. So I
    added the -J switch:

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

    So, I've hacked those bits into the latest cpan, which is not on
    github. Right now it's in the dump_config branch:

    http://github.com/briandfoy/cpan-script/tree/dump_config

    I've not tested it to see if everything else works.

    The next step is to add a -oconf switch, or something like that, so I
    can do things like replacing only some values:

    prompt$ cpan -oconf makepl_arg=foo

    That requires a lot more work on the innards though because the script
    isn't set up to do fancy argument processing. No idea how I'm going to
    do that just yet.
  • Brian d foy at Sep 19, 2008 at 9:06 pm

    On Thu, Sep 18, 2008 at 3:50 PM, Tina Müller wrote:
    Hi Brian,
    On Wed, 17 Sep 2008, brian d foy wrote:

    Also, since you want the feature, you have to be a tester. :)
    of course =)
    I'm moving this over to cpan-workers@perl.org so anyone can read the
    thread and it shows up in google, etc.
    Andreas showed me today how to convince CPAN::Shell to use a different
    directory. You call
    perl -I ~/.mycpan -MCPAN/MyConfig.pm -MCPAN -e shell
    (after creating an almost empty ~/.mycpan/CPAN/MyConfig.pm).
    This is basically what the new -j switch to cpan does, although it
    doesn't try to figure out if the configuration you load is valid yet.

    In the git repo (http://github.com/briandfoy/cpan-script/tree/app) I'm
    currently working in the app branch because I'm moving it to the
    App::Cpan set-up and I'm working on the test suite. The script mostly
    works as far as I can tell because I've been using it even while it is
    in development.

    Try this (after make, etc) in the dev dir:

    # dump the current config
    $ perl -Mblib script/cpan -J > MyConf.pm

    # change then load the current config
    # it should dump you into the shell, or you can give it some other command
    $ perl -Mblib script/cpan -j MyConf.pm

    # load and dump, to see if it all worked.
    $ perl -Mblib script/cpan -j MyConf.pm -J

    --
    brian d foy <brian.d.foy@gmail.com>
    http://www.pair.com/~comdog/
  • Tina Mueller at Oct 2, 2008 at 1:47 pm
    Hi Brian,
    On Fri, 19 Sep 2008, brian d foy wrote:

    This is basically what the new -j switch to cpan does, although it
    doesn't try to figure out if the configuration you load is valid yet.

    In the git repo (http://github.com/briandfoy/cpan-script/tree/app) I'm
    currently working in the app branch because I'm moving it to the
    App::Cpan set-up and I'm working on the test suite. The script mostly
    works as far as I can tell because I've been using it even while it is
    in development.

    Try this (after make, etc) in the dev dir:

    # dump the current config
    $ perl -Mblib script/cpan -J > MyConf.pm
    [...]

    sorry for the late answer, but I wasn't sure if I already could test it
    and then I was busy at work.
    Forgive me my question, but how to I checkout the source? I have never
    worked with git, not to mention branches in git. I have some problems on
    my debian box at work to install git also, I'll try it later at home.

    regards,
    tina
  • Brian d foy at Oct 3, 2008 at 1:28 am
    In article <alpine.DEB.1.10.0810021540200.9874@dev16-0.iconmobile.de>,
    Tina Mueller wrote:

    sorry for the late answer, but I wasn't sure if I already could test it
    and then I was busy at work.
    Forgive me my question, but how to I checkout the source? I have never
    worked with git, not to mention branches in git. I have some problems on
    my debian box at work to install git also, I'll try it later at home.
    If all else fails, you'll just have to wait for me to put a dev release
    on CPAN.

    The kludgey way is to go to github and download the files.

    http://github.com/briandfoy/cpan-script/tree/master

    With git, once you have it installed, to get the sources:

    $ git clone git://github.com/briandfoy/cpan-script.git

    Then you have the directory and you can just play with the files
    inside. To update that when I do new stuff:

    $ git pull

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcpan-workers @
categoriesperl
postedSep 17, '08 at 8:40p
activeOct 3, '08 at 1:28a
posts5
users4
websitecpan.org

People

Translate

site design / logo © 2021 Grokbase