1

I am trying to build LDV project by following this instructions, and i know nothing about perl.

i am getting the following error while running the test

ldv-task: NORMAL: Calling LDV-core.
Can't locate SOAP/Lite.pm in @INC (@INC contains: /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/5.10.0/x86_64-linux /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/5.10.0 /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/site_perl/5.10.0/x86_64-linux /home/acsia/perl5/perlbrew/perls/perl-5.10.0/lib/site_perl/5.10.0 .) at /home/acsia/Desktop/LDV/consol-tools/ldv-core/ldv-core line 7.
BEGIN failed--compilation aborted at /home/acsia/Desktop/LDV/consol-tools/ldv-core/ldv-core line 7.

output of

perlbrew use

is :EDITED:

Currently using perl-5.22.0

output of

locate SOAP/Lite.pm

is

/usr/local/lib/perl5/site_perl/5.22.0/SOAP/Lite.pm

output of

which perl

is

/usr/local/bin/perl

and the LDV-core file is starting like this by default

#!/usr/bin/perl -w
#
my $instrumnet = 'ldv-core';

use FindBin;
# To prevent meaningless module warnings use this instead of use.
BEGIN { $SIG{'__WARN__'} = sub{}; require SOAP::Lite; SOAP::Lite->import(); $SIG{__WARN__}='DEFAULT'; }
use POSIX ":sys_wait_h";
use XML::Twig;
use IO::Socket::INET;
#use File::MimeInfo;
use File::Basename;
use Cwd qw(abs_path);

etc,... etc....

Thanks for your time...

zappy
  • 1,864
  • 3
  • 18
  • 36
  • Try and move SOAP dir to perl 5.10.0 module structure which should be (i think) at /usr/local/lib/perl5/site_perl/5.10.0/ . This might solve your problem. – shivams Jun 04 '15 at 12:43
  • 4
    Don't just move modules about. Install them properly. – Quentin Jun 04 '15 at 12:45
  • @shivams ,@Quentin .. please check my edited question.. i have switched perl to 5.22.0 using "perlbrew" switch command...but still i am getting the same error – zappy Jun 04 '15 at 13:05
  • I wouldn't expect perlbrew to be using `/usr/local/bin/perl` (I'd expect something more like `/Users/david/perl5/perlbrew/perls/perl-5.18.0/bin/perl`). Is your `$PATH` in the right order? What do you get if you run `perl -v`? – Quentin Jun 04 '15 at 13:07
  • @Quentin .. output of perl -v : This is perl 5, version 22, subversion 0 (v5.22.0) built for x86_64-linux – zappy Jun 04 '15 at 13:10
  • 1
    @zappy Try and install `libsoap-lite-perl` package in ubuntu. This is library corresponding ot SOAP::Lite module. This might solve your problem. This will put corresponding modules in correct location. Try installing package. – shivams Jun 04 '15 at 13:10
  • @zappy — What's the output of `perl -E'say join " : ", @INC'`? – Quentin Jun 04 '15 at 13:11
  • @Quentin it is :/home/acsia/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0 : – zappy Jun 04 '15 at 13:16
  • 2
    That doesn't include `/usr/local/lib/perl5/site_perl/5.22.0/`which is where the module is. Try reinstalling it with `cpanm`. – Quentin Jun 04 '15 at 13:19
  • 2
    Theck the shebang line in your script, it's probably calling the wrong Perl. Or change it to `#!/usr/bin/env perl` to make it call whatever Perl is first in the `$PATH` (assuming you're using some POSIXy environment here). – reinierpost Jun 04 '15 at 13:24
  • @shivams i think...installing libsoap-lite-perl solved that error... but facing a new one now... thank you so much both of you – zappy Jun 04 '15 at 13:27
  • 2
    If installing the system package helped that proves that you are not using the perlbrew perl. – simbabque Jun 04 '15 at 13:38
  • @simbabque yeap.... understood that i am not doing the correct thing..... can anyone suggest me the correct method from the start?? what is the difference b/w using system perl and perlbrew perl??? – zappy Jun 04 '15 at 13:50
  • @reinierpost .. i followed your comment and replaced /usr/bin/perl with /home/acsia/perl5/perlbrew/bin which is the first brew in echo $PATH output....but i am getting error like :/home/acsia/perl5/perlbrew/bin: bad interpreter: Permission denied.... – zappy Jun 04 '15 at 13:55
  • 1
    There is a talk about perlbrew by its author *gugod* that explains where the difference is and how and why to use perlbrew. Check it out at https://www.youtube.com/watch?v=Ho0AK3sZz18. – simbabque Jun 04 '15 at 14:43
  • @zappy: you didn't follow my comment! – reinierpost Jun 04 '15 at 18:18

2 Answers2

4

If LDV-Core isn't yours, you should install SOAP::Lite using your system's package manager. If it's yours, read on.


perlbrew plays with your PATH so that executing perl will execute the desired perl.

But your script explicitly uses /usr/bin/perl, so which perl is currently selected using perlbrew switch or perlbrew use is irrelevant.

  1. Stop overriding the default install location, and stop looking where you shouldn't.

    unset PERL_MM_OPT
    unset PERL_MB_OPT
    unset PERL5LIB
    unset PERLLIB
    
    echo -ne 'o conf makepl_arg ""\no conf commit\n'   | cpan
    echo -ne 'o conf mbuildpl_arg ""\no conf commit\n' | cpan
    

    The first four lines only have a temporary effect. You should stop setting those variables in your login script to make the change permanent.

  2. Install SOAP::Lite in the desired Perl.

    perlbrew use perl-5.22.0    # Or perl-5.10.0 or whatever
    cpan SOAP::Lite
    
  3. Fix your script's shebang.

    perl -i~ -pe'
       next if $. != 1;
       s/^#!.*//s;
       $_ = "#!$^X\n$_";
    ' LDV-core
    

PS — You don't need use FindBin;.

ikegami
  • 367,544
  • 15
  • 269
  • 518
2

perlbrew perl is a way to install many perl versions in same machine. It is like virtenv in python. Perlbrew allow you to switch between various versions of perl and run perl programs against those versions.

system perl means the default version of perl which mostly come with linux distros. perlbrew changes that version against which program needs to run and your program will start running against different version.

If you are making something which does not require a lot of perl versions it is always better to use one version of perl and run programs against them.

Also if you are using linux distros and do not want to get into cpan and how to install perl modules, best is to search for corresponding libraries against that module and install them. For example in your case i search this way

aptitude search soap | grep perl

This give me two libraries on my ubuntu machine of which one is against this module. Installing them is easy and you can focus on your work rather than on how to install cpan modules.

shivams
  • 2,597
  • 6
  • 25
  • 47