-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add environment variable to customize .cpan path #149
Comments
A workaround for that is to install local::lib and export the environment variables before starting cpan for the first time. I agree that it would be nice if it was easier to do without installing local::lib beforehand. EDIT: one example of the environment variables is
|
This is helpful, but I can't get I have moved the perl stuff to I run mkdir /Users/bwaters/.cpan: File exists at /System/Library/Perl/5.30/CPAN/HandleConfig.pm line 595. If I remove that experimental block, it goes through the full setup of cpan. I tell it where it should set things. And indeed, after all there are correct paths in the resulting Try again (all commands are run from $HOME): % rm -rf .cpan
% rm -rf .local/share/{cpan,perl}
% mkdir .local/share/{cpan,perl}
% ln -s .local/share/cpan .cpan
% cpan And we do another first-time setup, only this time, I specify the I exit, then remove the vestigial symlink in Then run I try to get a bit further by specifying my CPAN config that we just created, there's all the right paths there: % grep cpan_home .local/share/cpan/CPAN/MyConfig.pm
'cpan_home' => q[/Users/bwaters/.local/share/cpan], CPAN is happy with this. So happy, it claims everything has been done already and we can all go home: % cpan -j ${HOME}/.local/share/cpan/CPAN/MyConfig.pm
Nothing to install! I haven't yet found a way to explain |
Got this working. Make sure that whatever directory you're using for your Here is a shell init script that I'm using to set environment variables appropriately: # updated: 2023-12-06 18:49:10
export VERSIONER_PERL_VERSION=5.34
export PERL_LOCAL_LIB_ROOT="${XDG_DATA_HOME}/perl"
export PERL_CPANM_HOME="${PERL_LOCAL_LIB_ROOT}/cpan"
export PERL5LIB="${PERL_CPANM_HOME}:${PERL_LOCAL_LIB_ROOT}/lib/perl5"
export PERL_MB_OPT="--install_base '${PERL_LOCAL_LIB_ROOT}'"
export PERL_MM_OPT=" INSTALL_BASE='${PERL_LOCAL_LIB_ROOT}'"
Note that the environment variable Note that (again, for mainline CPAN) you also have to set the absolute path to the Here is what I get when I have that ❯ cpan
Loading internal logger. Log::Log4perl recommended for better logging
cpan shell -- CPAN exploration and modules installation (v2.28)
Enter 'h' for help.
cpan[1]> o conf | grep local
$CPAN::Config options from /Users/bwaters/.local/share/perl/cpan/CPAN/MyConfig.pm:
build_dir [/Users/bwaters/.local/share/perl/cpan/build]
cpan_home [/Users/bwaters/.local/share/perl/cpan]
histfile [/Users/bwaters/.local/share/perl/cpan/histfile]
keep_source_where [/Users/bwaters/.local/share/perl/cpan/sources]
prefs_dir [/Users/bwaters/.local/share/perl/cpan/prefs]
cpan[2]> To summarize:
(You may see that in my example here, I'm running macOS. Apple ships two versions of Perl with the OS, 5.30 and 5.34. I've chosen to run with the more recent version (which is still out of date); I've set this choice via the |
So my home directory is not cluttered and I can make CPAN follow the XDG Basedir Spec.
PS: Can I customize where
local::lib
dumps its shit? Thatperl5
folder is bogging me...The text was updated successfully, but these errors were encountered: