perl modules installation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl modules installation
# 1  
Old 09-26-2012
perl modules installation

I have installed perl in windows.

Now I would like to install spreadsheet::xlsx & DateTime::Format::Excel modules(also few more) at a time instead of installing them seperately.

Could you please let me know how to install more than 1 module as a batch file in windows OS ?

Thanks in advance...

Regards,
GS
# 2  
Old 09-26-2012
My best guess is that you've installed Active State's ActivePerl. In that case, look for "Perl Package Manager" in perl's installation directory. Installing modules using perl package manager is a piece of cake. It'll even install dependent modules by itself.
This User Gave Thanks to balajesuri For This Post:
# 3  
Old 09-26-2012
Many thanks for replying the post.

Actually what my problem is, I have written few scripts which I need to provide them to my client.Since client is not aware of modules installations and all, he just wants the modules to be installed with a single click(writing all the commands in a single file to run from windows command line).

Perl is working on his system(from the command line) without activeperl.

So I am planning to give him a batch file which installs all the required modules.

Could you please me on this?

Regards,
GS
# 4  
Old 09-27-2012
One alternative is to have all the required .pm files in a library directory of your perl project and push the path to array @INC. Once this is done, you can use the required module.

For e.g., to use the Net::SSH module, you need to point perl to the location that contains SSH.pm. Copy SSH.pm in, say "c:\myProject\lib". Now in your perl script, before you use Net::SSH, you have to push (@INC, "c:\myProject\lib").

With this approach your client won't have to install any of the modules. And you must ensure that you have all the dependent modules present in the lib directory.
# 5  
Old 09-27-2012
module installed but not able to execute the perl script

Tons of thanks balajesuri...

one small doubt... based on requirement we write some scripts on UNIX and windows environment.

For one specific requirement I have used spreadsheet::xlsx in windows environment and executed the script successfully. After which I copied the same script to remote unix machine.

What the problem is, while trying to execute the script with spreadsheet::xlsx and DateTime::Format::Excel modules I got the below error messages on unix machine.
Code:
 
Can't locate DateTime.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi 
/usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/
site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/site_perl/5.10.0/DateTime/Format/Excel.pm line 13.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.10.0/DateTime/Format/Excel.pm line 13.
 
Can't locate spreadsheet/xlx.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi 
/usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/
5.10.0 /usr/lib/perl5/vendor_perl .) at groupD_final.pl line 7.
BEGIN failed--compilation aborted at groupD_final.pl line 7.
 


But our Admin has forwarded the list of modules that are installed on the Unix machine. Surprisingly the above modules were there in the list supplied.

Also attached both the module list taken out by me and admin seperately....

Not sure how to execute the script and how he found the modules list?

Could you please share your opinion on this?
# 6  
Old 09-27-2012
I'm not sure if you understood how modules work in perl.

The statement use Spreadsheet::XLSX in perl is crudely similar to java's import com.test.Utilities

Perl -> package::structure::moduleFileName which is similar to
Java -> package.structure.className

The same way as you can find Utilities.class in /path/to/myProj/bin/com/test/Utilities.class; you can find XLSX.pm in /path/to/perl/lib/Spreadsheet/XLSX.pm.

The default paths to search for modules is pre-defined in @INC. If you have XLSX.pm elsewhere, say for e.g., in /home/user/myProj/lib/Spreadsheet/XLSX.pm, you need to tell perl to look in this directory too -> /home/user/myProj/lib.

This can be achieved by push (@INC, "/home/user/myProj/lib"). After which if you say use Spreadsheet::XLSX, you won't see any error.

So when you say use DateTime::Format::Excel, perl is going to look for Excel.pm (DateTime/Format/Excel.pm) inside one of the directories listed in @INC.

Quote:
Originally Posted by giridhar276
Code:
Can't locate DateTime.pm in @INC
.
.
 Can't locate spreadsheet/xlx.pm in @INC

I observed two errors in post #5. In your perl code it looks like you gave,
1. use DateTime instead of use DateTime::Format::Excel
2. use spreadsheet::xlx instead of use Spreadsheet::XLSX

Hope this helps.

Last edited by balajesuri; 09-27-2012 at 06:57 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Modules installation in one go.

Hi, I have a task to install a list of perl modules in several servers. It's very tedious task to install it one by one through CPAN. Can I have option in CPAN to feed that list so that it install all the modules. (0 Replies)
Discussion started by: nixhead
0 Replies

2. Shell Programming and Scripting

how to create custom modules in perl and how to import all modules with single command?

I have some custom functions which i want to use in perl Scripting all time. i want to How to create modules in perl and how to import them. Also if i create 15 modules and i want to > import all at once then how can i import? (0 Replies)
Discussion started by: Navrattan Bansa
0 Replies

3. Shell Programming and Scripting

How to install perl modules in Solaris

Hi All, How to install the perl modules in Solaris? pwd /eweiquu/ocsta/lib/XML-Simple-2.18 and bash-3.00# perl Makefile.PL Checking installed modules ... XML::Parser is installed, it will be used by the test suite Writing Makefile for XML::Simple and then the readme file says,you... (2 Replies)
Discussion started by: Damon_Qu
2 Replies

4. Shell Programming and Scripting

How to find which perl modules version is used?

Hi All, I am rather new to the world of Perl programming. I have a question regarding the perl modules. I have a linux box running slackware 12.2 and has perl installed by default there (version 5.10.0) and it has several modules installed namely DBI and DBD::mysql that I wanted to upgrade. ... (2 Replies)
Discussion started by: aherrys
2 Replies

5. Red Hat

installing perl modules

Hi All, I have a customer asking me to install these perl modules on redhat 4 ent: File::Temp Getopt::Long DBD::mysql Mail::Mailer DBD::DB2 Any idea how can I install those modules. Thanks for any comment you may add. (3 Replies)
Discussion started by: itik
3 Replies

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

7. UNIX for Advanced & Expert Users

Installing GD Perl graphics modules

I'm on Mac OSX, I *think* I succeeded in installing libpng. I can see usr/local/lib/libpng.dylib and its brethren are in place after executing ./configure nd and the holy make install. (2 Replies)
Discussion started by: andrewduncan
2 Replies

8. UNIX for Dummies Questions & Answers

installing perl modules

I resulted to using /usr/sfw/bin/gmake to install my perl modules until i ran into a problem installing perl/Tk Tk-804.028 gmake: Entering directory `/export/home/Tk-804.028/pod' Sorry no HTML building yet gmake: Leaving directory `/export/home/Tk-804.028/pod' I dont unstand what the error... (2 Replies)
Discussion started by: jameskay
2 Replies

9. Shell Programming and Scripting

extracting used perl modules

Hi, I am trying to extract the includes from all the perl programs in my application space;ie. i want the list of all used modules in my application. First i did a grep like 'grep -r "^use.*;$" * > ~dileepp/search.txt' which gives me the output in the form "filename:line containing use"... (0 Replies)
Discussion started by: DILEEP410
0 Replies

10. Shell Programming and Scripting

Installing Perl Modules

I have a script that uses the File::Listing module. I am trying to install it, but I read the ReadMe and it states that the following modules should be installed first: URI MIME-Base64 HTML-Parser libnet Digest-MD5 Compress-Zlib I am very new to Perl and would apprciate anyone's input on... (1 Reply)
Discussion started by: ssmiths001
1 Replies
Login or Register to Ask a Question