Re: Installing perl modules
by toolic (Bishop) on Apr 11, 2011 at 19:18 UTC
|
You also need to instruct perl where to look for your module using one of the following methods:
See also @INC | [reply] [d/l] |
Re: Installing perl modules
by marto (Cardinal) on Apr 11, 2011 at 19:21 UTC
|
| [reply] |
Re: Installing perl modules
by dasgar (Priest) on Apr 11, 2011 at 19:57 UTC
|
can I just put it in a local directory and just say "use /*path to module*/" at the beginning of my perl script? Would that work?
I believe that if the module installation involves the use of a compiler to build the module, you could run into issues if the .pm file was compiled with a different compiler than what was used to create your instance of Perl. Otherwise, copying the file to the normal locations that Perl looks into or following suggestions from toolic's posting should work.
On the other hand, I believe that it would be better if you would go ahead and install from CPAN (or from repositories if you're using ActiveState's ActivePerl.) If you're having problems with installing from CPAN, marto included a good link with useful information about installing modules from CPAN.
| [reply] |
Re: Installing perl modules
by solaris7 (Novice) on Apr 11, 2011 at 20:08 UTC
|
Hi Guys,
Thanks for the replies. The module in question is the Net::SSH::Expect module. I download the tar file, unzipped it and found the Expect.pm in the lib folder. I then proceeded to change the PERL5LIB Variable using export. However, nothing changed. Do I need to include anything else in my script apart from
"use lib '~/perl_modules' ", if I try putting in the "use Net::SSH::Expect" it flags as an error saying it could not find it.
Thanks in advance. | [reply] |
|
|
If you are literally using the tilde character, try using the full path to your "perl_modules" dir instead.
Show us the exact error message, using "code" tags (see Writeup Formatting Tips).
Your Expect.pm file must be under a "Net/SSH" directory path.
This will also be useful:
use Data::Dumper;
print Dumper(\@INC);
| [reply] [d/l] |
Re: Installing perl modules
by Argel (Prior) on Apr 11, 2011 at 21:09 UTC
|
Why is'perl Makefile.PL' not an option?
Elda Taluta; Sarks Sark; Ark Arks
| [reply] |
|
|
Of course, that is the first step. This Perl module (Makefile.PL) constructs a makefile which has various build-targets including install and test. This is the (well-documented) process that actually happens, whether invoked from cpan or not.
| |
|
|
My point was that the OP did not explain why going through the perl Makefile.PL process would not work. It's worth asking about because 1) the OP may not be familiar with it and 2) it may shed light on why he needs/wants to just copy the Perl module if he is (i.e. feels like an XY problem).
I'm not really sure what your point is. Running "perl Makefile.PL" is most assuredly NOT the first step (unless the module requires C code compiled in and there's probably a way to get around that). If the module is pure Perl then it's possible to just copy the module to just about any location and then update %INC. Not necessarily wise, but still quite possible.
In fact, I did that with Expect.pm (not the Net::SSH::Expect the OP is talking about). I copied it from a Solaris 10 system to a Red Hat Enterprise Linux system to get a script our vendor has sent us to collect debug data working. No perl Makefile.PL used there....
Elda Taluta; Sarks Sark; Ark Arks
| [reply] |
Re: Installing perl modules
by locked_user sundialsvc4 (Abbot) on Apr 11, 2011 at 20:18 UTC
|
The proper place to begin is to “Google it,” or to use Super Search.
Every CPAN module has its own specific mechanism for testing and installing itself. That mechanism is designed to work easily with the cpan command, and, with or without that command, to “do the right thing™” correctly and seamlessly. (Whether it actually does so or not, in any particular case, is an engineering question... ;-) ) So, whether or not you decide to use the cpan command to invoke the package’s installation procedure, you do need to follow that procedure.
I say, quite sincerely ... save yourself some hair-follicles and do some preliminary web-research concerning this very Frequently Asked Question. You are not exactly “in a china shop,” but stumbling around and whacking at it is not likely to be productive.
| |