in reply to CPAN non-root questions

To quote perldoc cpan:
The default values defined in the CPAN/Config.pm file can be overridden in a user specific file: CPAN/MyConfig.pm. Such a file is best placed in $HOME/.cpan/CPAN/MyConfig.pm, because $HOME/.cpan is added to the search path of the CPAN module before the use() or require() statements.

The second problem is the @INC. Is there a way to fool a root-installed binary into adding your ~/my-mods to @INC?

Well, you could set PERL5LIB before you run that binary.

Is there a transparent way to globally modify @INC?

What do you mean by "globaly"? For every process run by a specific user? Set PERL5LIB in that user's login script (actual syntax and filename depends on that user's shell).

Update: (Thanks to borisz): meant to write PERL5LIB, wrote PERL5INC instead. Apologies for the bainfart.

Replies are listed 'Best First'.
Re: Re: CPAN non-root questions
by jettero (Monsignor) on Apr 02, 2004 at 18:40 UTC
    Sorry, by globally I meant for all processes run by that user. So, you're guess was 100% correct. Also, your post answered all my questions. Thanks.
Re[1]: CPAN non-root questions
by Intrepid (Curate) on Apr 03, 2004 at 18:18 UTC

    matija arose from serene meditation and wisely quoth:

    To quote perldoc cpan:
    The default values defined in the CPAN/Config.pm file can be overridden in a user specific file: CPAN/MyConfig.pm. Such a file is best placed in $HOME/.cpan/CPAN/MyConfig.pm, because $HOME/.cpan is added to the search path of the CPAN module before the use() or require() statements.

    IIANM there are two situations under which the ~/.cpan/CPAN/MyConfig.pm file and its parent dirs can come to exist:

    1. The user is the first one to ever run CPAN.pm on that perl installation (hey, it can happen, on a not-uncommon single-user workstation setup), or
    2. The user does what has been cited above, explicitly creating the ~/.cpan/CPAN/MyConfig.pm file and manually editing the contents to create appropriate settings. In many cases (altho I believe it is not suggested explicitly in the Fine Documentation for CPAN.pm), the sensible thing to do is to copy the system-wide Config.pm file from wherever it resides, into one's private dir. Then "guess" at what the changes needed should be.

    In the case (1) above, when CPAN.pm is invoked in the usual manner (on older perls, typically by doing perl -MCPAN -e shell, and on newer ones by just using the wrapper script named 'cpan' which does the same thing internally) .. in that case the obligatory (and lengthy, and often confusing for new perl users) setup interaction will suggest that such a file will be created when the user is done with the interroga .. er, dialogue.

    IMHO this is all a little bit harder than it ought to be. I could describe the points in detail now but will save it for another time (especially since I've been working on a project that addresses this very area).

    If I am mistaken on any of the factual points (non-subjective, as contrasted with characterizations like "harder than" or "confusing") I would appreciate being corrected. Cheers,