Automating CPAN on FreeBSD


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automating CPAN on FreeBSD
# 1  
Old 04-08-2009
Automating CPAN on FreeBSD

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:
Code:
perl -MCPAN -e "install DBD::SQLite"

and getting trapped into the CPAN dialogue, I might as well do the following:
Code:
cd /usr/ports/databases/p5-DBD-SQLite
make install clean

or
Code:
pkg_add -r p5-DBD-SQLite

Is that a fair alternative?
# 2  
Old 04-14-2009
Ports will not help if you have specific packages that do not exist on the ports tree.

You may try to see if a CPAN no-prompt trick will help you. It may work for some modules but perhaps not for the rest. There's no harm trying though.

CPAN - perldoc.perl.org

Take a look at Q13.
# 3  
Old 04-15-2009
Thank you for your response. The bit that I have added to the line will make a line look as follows:
Code:
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e "install Term::ReadLine::Gnu"

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.
# 4  
Old 04-16-2009
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.

Please refer to this section:

CPAN - perldoc.perl.org

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.
# 5  
Old 04-16-2009
Thank you for your response. This is the content of the $HOME/.cpan/CPAN/Config.pm file:
Code:
$CPAN::Config = {
'build_cache' => q[10],
'build_dir' => q[/root/.cpan/build],
'cache_metadata' => q[1],
'cpan_home' => q[/root/.cpan],
'ftp' => q[ ],
'ftp_proxy' => q[ ],
'gzip' => q[/usr/bin/gzip],
'histfile' => q[/root/.cpan/histfile],
'histsize' => q[100],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'makepl_arg' => q[],
'ncftp' => q[ ],
'ncftpget' => q[ ],
'no_proxy' => q[],
'pager' => q[/usr/bin/less],
'prerequisites_policy' => q[follow],
'proxy_user' => q[],
'scan_cache' => q[atstart],
'shell' => q[/bin/sh],
'tar' => q[/usr/bin/tar],
'term_is_latin' => q[1],
'unzip' => q[],
'urllist' => [q[http://www.perl.com/CPAN/]],
'wget' => q[],
};

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.

Last edited by figaro; 04-16-2009 at 06:52 AM.. Reason: Added new information.
# 6  
Old 04-16-2009
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.
# 7  
Old 04-16-2009
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.

Will come back with more details later.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to install CPAN without using yum on Linux?

Hi all, I am on Linux box where CPAN is not working for downloading any perl modules. When I try "perl -MCPAN -e shell" as root as well as a user, I get following error: Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl... (2 Replies)
Discussion started by: pat_pramod
2 Replies

2. Shell Programming and Scripting

Unable to install module using cpan

Hi, I am unable to install module using cpan. It says 407 Proxy Authentication Required I did setup proxy server and given username and password in .bashrc file and apt.conf file. export http_proxy=http://username:password@proxyserver:portno/ However, still unable to install... (1 Reply)
Discussion started by: Anjan1
1 Replies

3. Shell Programming and Scripting

cpan installation

Hi All, I need to install perl module using cpan, so befor that i checked cpan is installed or not . i tried , and got below output.but it is not clear to me. can u plz explain me. I dont know what the exactly cpan is useful. and in below why it is trying to create directory. $ cpan... (2 Replies)
Discussion started by: aish11
2 Replies

4. UNIX for Dummies Questions & Answers

Problem to upgrade CPAN

Hi all, Since yesterday, I'm trying to upgrade CPAN on my Synology sevrer, because I have the next message in CPAN shell : cpan> install cpan CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Going to read /root/.cpan/sources/authors/01mailrc.txt.gz CPAN: Compress::Zlib... (2 Replies)
Discussion started by: mikael2235
2 Replies

5. Shell Programming and Scripting

Building my own CPAN repository

Hi there , im not sure whether im in the right section, but because im talking about perl, i guess this is the right place :-) I have a whole host (thousands in fact) of Solaris machines that are running different versions of perl with different module sets etc. I wanted to know whether it... (6 Replies)
Discussion started by: rethink
6 Replies

6. Shell Programming and Scripting

Error while trying to install from CPAN

Hi i was trying to install Text::CSV from cpan... it seemed to have downloaded everythign properly but was not able to run the make file... do u have any idea as to why this happened?? Install: ============================= If you install Text::CSV_XS v.0.70, it makes Text::CSV faster. ... (5 Replies)
Discussion started by: VGR
5 Replies

7. Programming

Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3

Hello there, My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64. It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386). The current machine has 2x Core 2 Duo... (1 Reply)
Discussion started by: Seenquev
1 Replies

8. Shell Programming and Scripting

CPAN: using only wget to d/l modules?

Is there a way to tell CPAN not to use Net::Ftp and the ftp binary? I want to only use wget to download perl modules. (2 Replies)
Discussion started by: dangral
2 Replies

9. UNIX for Dummies Questions & Answers

CYGWIN/CPAN install of Expect.pm

I am attempting to install a Perl Expect module via the CPAN . CPAN goes through the process but nothing happens, sample perl scripts can not find the Expect Module. CPAN was configured via the Default process " Are you ready for manual configuration? " answered "no". CPAN install seemed to find... (1 Reply)
Discussion started by: white222
1 Replies
Login or Register to Ask a Question