I see you're on Perl 5.8.8 -- a release of Perl that's over six years old. The 
"use feature" pragma didn't come in until Perl 5.10 (current version is 5.16). 
All that "use feature" does is give you access to the "say" command. Say is 
like "print" except that it automatically includes a "\n".

Use this program. I removed "say" and used "print" instead:

#!/usr/bin/env perl
use strict;
use warnings;

use Log::Log4Perl

print  "Perl \@INC: " . join ("\n", @INC) . "\n";
for my $module (sort keys %INC) {
    print qq(\$INC{$module} = "$INC{$module}"\n);
}

By the way, note the @INC array which printed out as part of the error message:

* /usr/coderyte/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
* /usr/coderyte/lib/perl5/site_perl/5.8.8 
* /usr/coderyte/lib/perl5/5.8.8/x86_64-linux-thread-multi 
* /usr/coderyte/lib/perl5/5.8.8 

Compare that with the one you got as the Jenkins user. (You didn't include that 
in your original email!). I can see that Perl 5.8.8 isn't installed as a 
standard Perl program because it's under /usr/coderyte and not a standard 
directory. On most Unix type systems it's under /usr/share/perl or 
/usr/local/perl, or /var/perl or /opt/perl. I suspect that your Jenkins user is 
looking in different directories and maybe even using a completely different 
version of Perl.

What's the full error message you're getting with Jenkins. You only gave:

> 11:41:35 Can't locate Log/Log4perl.pm in @INC (@INC contains: 

You left off the interesting part.

On Nov 1, 2012, at 12:56 PM, Kamal Ahmed <kamal2222ah...@yahoo.com> wrote:

> Hi David,
> Now i am getting error:
> 
> ./test_log4p.pl 
> Can't locate feature.pm in @INC (@INC contains: 
> /usr/coderyte/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi 
> /usr/coderyte/lib/perl5/site_perl/5.8.8 
> /usr/coderyte/lib/perl5/5.8.8/x86_64-linux-thread-multi 
> /usr/coderyte/lib/perl5/5.8.8 .) at ./test_log4p.pl line 4.
> BEGIN failed--compilation aborted at ./test_log4p.pl line 4.
> 
> 
>  more test_log4p.pl 
> 
> #!/usr/bin/env perl
> use strict;
> use warnings;
> use feature qw(say);
> 
> use Log::Log4Perl
> 
> say "Perl \@INC: " . join "\n", @INC;
> for my $module (sort keys %INC) {
>     say qq(\$INC{$module} = "$INC{$module}");
> }
> 
> From: David Weintraub <qazw...@gmail.com>
> To: jenkinsci-users@googlegroups.com 
> Sent: Thursday, November 1, 2012 12:27 PM
> Subject: Re: /usr/bin/prove: Cannot find blib
> 
> Perl CPAN modules can be installed via user or via machine. Normally, if you 
> can't get root access on the machine, you install it for that user. Maybe the 
> Log::Log4perl module is installed as a user module. Thus, if you're running 
> it as another user, you simply can't find the module.
> 
> Another possibility is that the module wasn't installed, and is located in a 
> different directory than expected. The Perl @INC shows you the directories 
> where modules are searched. The %INC hash shows the module loaded and the 
> directory where found. 
> 
> Try a simple program:
> 
> use strict;
> use warnings;
> use feature qw(say);
> 
> use Log::Log4Perl
> 
> say "Perl \@INC: " . join "\n", @INC;
> for my $module (sort keys %INC) {
>     say qq(\$INC{$module} = "$INC{$module}");
> }
> 
> Do this via SSH where you can execute run_prove.sh and it works. This will 
> show you where this program is searching for the module and where it finds 
> it. That will give you an idea why Jenkins can't find it.
> 
> If you do find that Log::Log4Perl is not where you expect it, use the "use 
> lib" pragma to add that directory to your @INC search array.
> 
> On Nov 1, 2012, at 12:15 PM, Kamal Ahmed <kamal2222ah...@yahoo.com> wrote:
> 
>> Hi,
>> When i run run_prove.sh after doing an ssh to host , the perl unit tests run 
>> fine
>> but when i do it via "Execute shell script on remote host using ssh" i get 
>> error:
>> 
>> 11:41:35
>>  + prove -b -v -r .
>> 
>> 11:41:35
>>  /usr/bin/prove: Cannot find blib
>> 
>> 11:41:35
>>  No blib directories found.
>> 
>> 11:41:35 Can't locate Log/Log4perl.pm in @INC (@INC contains: 
>> 
>> I have tried with just execute shell script option as well, same result
>> 
>> Would appreciate any help / Hint/Resolution
>> 
>> Thanks,
>> -Kamal.
>> 
>> 
> 
> 
> 

Reply via email to