How to automatically install all modules required by a script from CPAN?


 
Thread Tools Search this Thread
Top Forums Programming How to automatically install all modules required by a script from CPAN?
# 1  
Old 11-17-2012
How to automatically install all modules required by a script from CPAN?

Having a script.pl how can I automatically download from CPAN all required modules and install and update as required? Something like "emerge -uDNav world" for the perl?

---------- Post updated at 05:38 PM ---------- Previous update was at 05:28 PM ----------

Doesn't matter I've found it

Code:
cat *.pl  | grep "^use " | tr ';' ' ' | while read a b c; do echo $b; done | sort -iu | while read a; do cpan $a; done

# 2  
Old 11-18-2012
In the CPAN shell:

Code:
o conf prerequisites_policy follow
o conf build_requires_install_policy yes 
o conf commit

This User Gave Thanks to radoulov For This Post:
# 3  
Old 11-18-2012
Quote:
Originally Posted by radoulov
In the CPAN shell:

Code:
o conf prerequisites_policy follow
o conf build_requires_install_policy yes 
o conf commit

It's not working:
Code:
# perl backup.pl 
Can't locate Crypt/OpenSSL/PBKDF2.pm in @INC

# 4  
Old 11-19-2012
Posting the result of cpan <module_name> will be helpful (we don't know what backup.pl contains).

If need to automate the download of the dependencies, you may need to configure the Internet connection:

Code:
o conf init connect_to_internet_ok

or

Code:
o conf init urllist

This User Gave Thanks to radoulov For This Post:
# 5  
Old 11-19-2012
Quote:
Originally Posted by radoulov
Posting the result of cpan <module_name> will be helpful (we don't know what backup.pl contains).
Code:
# cpan Crypt/OpenSSL/PBKDF2.pm
Going to read '/root/.cpan/Metadata'
  Database was generated on Sun, 18 Nov 2012 00:55:04 GMT
Running install for module 'Crypt::OpenSSL::PBKDF2'
Running make for S/SK/SKUPSY/OpenSSL/Crypt-OpenSSL-PBKDF2-0.02.tar.gz
Checksum for /root/.cpan/sources/authors/id/S/SK/SKUPSY/OpenSSL/Crypt-OpenSSL-PBKDF2-0.02.tar.gz ok

  CPAN.pm: Going to build S/SK/SKUPSY/OpenSSL/Crypt-OpenSSL-PBKDF2-0.02.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Crypt::OpenSSL::PBKDF2
Writing MYMETA.yml
cp PBKDF2.pm blib/lib/Crypt/OpenSSL/PBKDF2.pm
AutoSplitting blib/lib/Crypt/OpenSSL/PBKDF2.pm (blib/lib/auto/Crypt/OpenSSL/PBKDF2)
/usr/bin/perl /usr/share/perl/5.14/ExtUtils/xsubpp  -typemap /usr/share/perl/5.14/ExtUtils/typemap -typemap typemap  PBKDF2.xs > PBKDF2.xsc && mv PBKDF2.xsc PBKDF2.c
Please specify prototyping behavior for PBKDF2.xs (see perlxs manual)
cc -c  -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.02\" -DXS_VERSION=\"0.02\" -fPIC "-I/usr/lib/perl/5.14/CORE"   PBKDF2.c
PBKDF2.c:67:25: fatal error: openssl/ssl.h: No such file or directory
compilation terminated.
make: *** [PBKDF2.o] Error 1
  SKUPSY/OpenSSL/Crypt-OpenSSL-PBKDF2-0.02.tar.gz
  /usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

# 6  
Old 11-19-2012
I believe that you need the OpenSSL headers and you need to install them manually. Use CPAN to install Perl modules, not OS packages.
This User Gave Thanks to radoulov For This Post:
# 7  
Old 11-19-2012
Quote:
Originally Posted by radoulov
I believe that you need the OpenSSL headers and you need to install them manually. Use CPAN to install Perl modules, not OS packages.
Thank you, it was solved installing the SSL headers
Code:
sudo apt-get install libssl-dev

Login or Register to Ask a Question

Previous Thread | Next Thread

10 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

Script to install Perl Modules

Hi guys, I need to upgrade perl modules on about multiple machines. I'm writing a for loop for it. for i in 1 2 3 4 5 6; do ssh server$i " sudo cpan Mozilla::CA, sudo cpan LWP::UserAgent, sudo cpan LWP::Protocol::https, sudo cpan IO::Socket::SSL, sudo cpan Net::SSL,... (2 Replies)
Discussion started by: scj2012
2 Replies

3. 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

4. OS X (Apple)

Unable to install Perl module via CPAN

Hi, I am trying to install Unicode::String from the cpan shell, and here is what I get: Checking if your kit is complete... Looks good Writing Makefile for Unicode::String cp String.pm blib/lib/Unicode/String.pm cp lib/Unicode/CharName.pm blib/lib/Unicode/CharName.pm... (3 Replies)
Discussion started by: psychomachine
3 Replies

5. 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

6. Shell Programming and Scripting

[Perl] How to install with CPAN specified version of module

Hello all, i am searching how to install a module but the question is : howto specify CPAN to install a determined version of the module ? In my case i want to install DBD:Oracle1.14 and not version 1.23 proposed ! Any idea welcome ! :rolleyes: Thanks ! (1 Reply)
Discussion started by: sun_cracker
1 Replies

7. Shell Programming and Scripting

How to install perl modules

Hi. i installed perl 5.8.8.822 in my D: drive(windows xp).When im trying to install IO-Stringy.pm module( or any module for tat matter ) it is getting installed in 'c:\temp\please run installed script' folder no matter from where ever i run the ppm installation.The path variable is set to... (3 Replies)
Discussion started by: Anuj8584
3 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. HP-UX

Modules Required For SCSI Tape?

I've got an HP9000 server and I'm trying to hook up a tape drive to it. When I go into "SAM-->Peripheral Devices-->Tape Drives", the tape isn't listed. I then choose to "ADD" a drive, and I get the following error. I know I need to install the "stape" module, but for some reason even that... (2 Replies)
Discussion started by: quantumdude
2 Replies

10. 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