When using CPAN for the first time, a number of questions are prompted to the user, thereby halting the process. Since I am running FreeBSD I was wondering whether the inclusion of the port instead leads to the same result. So instead of having the following:
perl -MCPAN -e "install DBD::SQLite"
and getting trapped into the CPAN dialogue, I might as well do the following:
cd /usr/ports/databases/p5-DBD-SQLite
make install clean
Problematically, this will bring the script in an endless loop requesting the user to select a geographical location of the CPAN server, without the possibility for the user to provide any answer.
This is not the problem due to the package, but the CPAN installation being not set up on a specific workstation/user yet. That option will not help with this, because you must set up the configuration on first use.
One possible thought is to manually copy an existing CPAN configuration file and make sure it is installed in the user environment before you execute other CPAN commands. Try it and tell us if it works.
It looks like it is working, but I will run some more tests to see what is the optimal configuration, since it has not run uninterrupted for various other reasons.
UPDATE: even on a clean installation of the operating system I have not been able to make this work; the same CPAN questions keep appearing, please advise.
Are you sure you are putting it in the correct home dir (your config seems to work only with "root")?
One suggestion. Try to run cpan with strace and find out (from the system calls output) what locations cpan has sought for the configuration file(s). It's not very easy to trace this way but will certainly give you a better idea how the search goes. Make sure cpan has actually tried to find that file.
I don't have access to a Linux Perl installation at the moment. Will try myself maybe tomorrow if I have the time.
The script this comes from is run as root as part of a system installation. The directory .cpan and its subdirectory CPAN are created on the fly. The Config.pm is placed in $HOME/.cpan/CPAN and the cpan modules are loaded. It's the last bit that is not silent.
Thank you again for your help. The file Config.pm is in a different location in my case, namely: /usr/local/lib/perl5/5.8.8/BSDPAN/Config.pm
The contents do not look like a Config.pm as outlined in the various tutorials on the web. It has not been touched for months, and I cannot tell if it was accessed either.
Strace will not install on a i386 system.
If you can enter the cpan shell (by running "cpan" or "perl -MCPAN -e shell"), the "o conf" command generated output will tell you the locations from which configuration is read.
This is mine on a certain Linux system I have:
admin@np64gw:~$ cpan
cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support available (try 'install Bundle::CPAN')
cpan> o conf
CPAN::Config options from /usr/lib/perl5/5.8.7/CPAN/Config.pm and /test/.cpan/CPAN/MyConfig.pm:
commit Commit changes to disk
defaults Reload defaults from disk
init Interactive setting of all options
build_cache 10
build_dir /test/.cpan/build
cache_metadata 1
cpan_home /test/.cpan
...
Thanks for your response. I generated the Config.pm file using the same output, namely from "o conf". The path at the top is /usr/local/lib/perl5/5.8.8/CPAN/Config.pm
when invoking cpan. So actually different from where I put my hand-crafted version. Are you suggesting I should overwrite the one shown in this posting with the hand-crafted one?
Also typo in my previous post:
This should be: Strace will not install on a non-i386 system.
If cpan is looking at the location specified, then you should overwrite it or it will not be seen. Of course please keep backup of the original file before you overwrite it, as your version may not necessarily work!
The following solution works and places the Config.pm file in two places:
$HOME/.cpan/CPAN
/usr/local/lib/perl5/5.8.8/CPAN/
The directories are created in a script, in case they do not exist.
Forum members testing this might want to indicate which of the two locations actually makes the difference.