PDA

View Full Version : Help with Perl Module



polcham
10-01-2009, 03:33 AM
It is installed as a perl module.

The module came from CPAN cpan.org

Now that I have it on the blue host server, I am trying to use it.

I need help in deciphering what I am being instructed to do.

I have instructions from my host say the following:


Perl modules are collections of functions that allow you to perform tasks in Perl. You will need to install a Perl module before you can use it inside a Perl program.

Note: Modules are installed directly from the CPAN repository.



Location of Your Perl Module(s)
Path: /home/aboul/perl



Using Your Perl Module(s)
You will need to add /home2/aboutell/perl to the include path.
You can do this by adding the following code to your script:

BEGIN {
my $homedir = ( getpwuid($>) )[7];
my @user_include;
foreach my $path (@INC) {
if ( -d $homedir . '/perl' . $path ) {
push @user_include, $homedir . '/perl' . $path;
}
}
unshift @INC, @user_include;
}





I do not understand what exactly must be done to enable me to use the module.


Can anyone help me?

Thank you.

Adam
10-01-2009, 06:26 AM
It's telling you that after you install the module to your account through the 'Perl Modules' link in your cPanel, you'll need to add this block of code after the shebang line, but before the 'use/require' lines.

For example:

#!/usr/bin/perl

BEGIN {
my $homedir = ( getpwuid($>) )[7];
my @user_include;
foreach my $path (@INC) {
if ( -d $homedir . '/perl' . $path ) {
push @user_include, $homedir . '/perl' . $path;
}
}
unshift @INC, @user_include;
}

use Module;
use Another::Module;
etc..

cats
12-20-2009, 09:40 AM
Hi Guys,

I have the exact same problem as polcham, trying to use SSL for Dadamail. I am not clear on which file I need to add this block to. Adam said to add it after the shebang line in my script but I can't seem to find which is the script file for dadamail. I started to go through the files under the dadamail directory but there are a lot of files :confused: Can you tell me which is the correct file to add this block to?

Many thanks in advance,

cats

vojnet
05-18-2010, 11:11 PM
Well,

1. It is not quite clear: is the directory to .pm Perl module files actually the "perl" directory? Because .pm files are not there, they are in the /perl/usr/lib/perl5/site_perl/5.8.8 directory.
2. I am installing a "mwforum", and it has it's own modules and scripts - it is going to be a guessing game for me to figure out which modules/scripts need to be updated with the location of the modules, and also if this location is actually correct.

Thanks for any help with this.