This is the code that works for me: my $homedir = (getpwuid($>))[7]; my $n_inc = scalar @INC; for (my $i = 0; $i < $n_inc; $i++ ) { if (-d $homedir . '/perl' . $INC[$i]) { unshift(@INC,$homedir . '/perl' . $INC[$i]); $n_inc++; $i++; } }
The reason for it working is because my perl modules that I install via cpanel are installed in /home/<username>/perl/ You seem to be installing them in: /home/directory/perl/usr/lib/perl5/site_perl/5.8.8/ It very much looks like your problem stems from that, I cannot verify this as I do not have access to my own box from work (yes security is pretty decent over here), but I would guess then using data dumper and printing the @INC variable you should be able to figure out where things are going wrong. So after your include statment write the following: use Data::Dumper; print Dumper @INC; This should get you a list that looks a little like this: $VAR1 = '/usr/local/lib/perl5/5.8.8/i686-linux'; $VAR2 = '/usr/local/lib/perl5/5.8.8'; $VAR3 = '/usr/local/lib/perl5/site_perl/5.8.8/i686-linux'; $VAR4 = '/usr/local/lib/perl5/site_perl/5.8.8'; $VAR5 = '/usr/local/lib/perl5/site_perl'; $VAR6 = '.'; As you can see this is a different box and as such it will most likely be different for you as well but at least you will be able to find where perl is looking for the modules. Hope it helps, regards, Rob Now this is exactly what our fine cpanel v3 is suggesting and the reason for it working is because: 1) My prompt is On 9/17/07, perllearner <[EMAIL PROTECTED]> wrote: > > I am having a look at cpanel v3 code for using a perl module after > installing it in your user directory (when not root): > > my $homedir = (getpwuid($>))[7];my $n_inc = scalar @INC;for (my $i = > 0; $i < $n_inc; $i++ ) { if (-d $homedir . '/perl' . $INC[$i]) > { unshift(@INC,$homedir . '/perl' . $INC[$i]); $n_inc+ > +; $i++; }} > > However this doesn't work, I came across a website > > http://digitalpbk.blogspot.com/2007/09/cpanel-v3-perl-include-inc.html > > that suggests it works with > ..... > > This script dint work for me much, so I manually included the include > locations into the BEGIN segment. > > > #! /usr/bin/perl -wBEGIN {unshift @INC,"/home/directory/perl/usr/lib/ > perl5/site_perl/5.8.7/";}... > > I am slightly confused as to how this is done > > there are no email details so I cannot email him direct to find out > how it was done, > > I tried amending > > my $homedir = (getpwuid($>))[7];my $n_inc = scalar @INC;for (my $i = > 0; $i < $n_inc; $i++ ) { if (-d $homedir . '/perl' . $INC[$i]) > { unshift(@INC,$homedir . '/perl' . $INC[$i]); $n_inc+ > +; $i++; }} > > so it says > > my $homedir = (getpwuid($>))[7];my $n_inc = scalar @INC;for (my $i = > 0; $i < > $n_inc; $i++ ) { if (-d $homedir . '/perl' . $INC[$i]) { > BEGIN {unshift @INC,"/home/directory/perl/usr/lib/perl5/site_perl/ > 5.8.8/";} $n_inc++; $i++; > }} > > still can't find the module > > I also tried his suggested begin{...} include statements with and > without the above code and still no luck with perl finding the module, > even though the module is correctly installed in my directory, any > help to get perl to recognise the module will be greatly appreciated. > thanks in advance > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > >