4

Background (not a mandatory read)

I started my current job as a web development intern. The guy who was teaching me left half way through and I have basically been left up sh*t creek with only a Google paddle since there is almost no documentation on how to run any of the servers. Instead of developing, I now mainly maintain the software on the servers including the company Intranet.

Situation

Im used to working with Python, but we currently have a Development Intranet which is down and seems to run on, or at least is started by, Perl scripts. The server is running Solaris 10.

Im trying to run a .pl file but the system complains that it cannot find LWP/Simple.pm

LWP/Simple.pm is there, but its under a different Perl version.

perl/lib/site_perl/5.6.1/LWP/Simple.pm

But the current version is:

@INC:

/usr/perl5/5.8.4/lib/sun4-solaris-64int
/usr/perl5/5.8.4/lib
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int
/usr/perl5/site_perl/5.8.4
/usr/perl5/site_perl
/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int
/usr/perl5/vendor_perl/5.8.4
/usr/perl5/vendor_perl

bash-3.00# perl -V

Summary of my perl5 (revision 5 version 8 subversion 4)

I am very reluctant to install anything new, as this MUST have been started before, so everything should be in place. I just need to understand how all of this works. Is @INC like LD_LIBRARY_PATH?

How would you switch the current version? Is there something for Perl which is like virtualenv?

I've had a go at declaring the Perl version, but that just gives the same error message:

perl/bin/perl5.6.1 bin/emwd.pl

The actual error is:

Can't locate LWP/Simple.pm in @INC (@INC contains: /ade_autofs/ade/perl/bin/Solaris/Opt/lib/5.6.1/sun4-solaris /ade_autofs/ade/perl/bin/Solaris/Opt/lib/5.6.1 /ade_autofs/ade/perl/bin/Solaris/Opt/lib/site_perl/5.6.1/sun4-solaris /ade_autofs/ade/perl/bin/Solaris/Opt/lib/site_perl/5.6.1 /ade_autofs/ade/perl/bin/Solaris/Opt/lib/site_perl .) at bin/emwd.pl line 173. BEGIN failed--compilation aborted at bin/emwd.pl line 173.

Seems straight forward, but Im not sure I should be changing @INC

chicks
  • 3,639
  • 10
  • 26
  • 36
JackalopeZero
  • 201
  • 2
  • 8
  • There may be multiple versions of Perl installed. Check the install directory for binaries containing version numbers. – Chris S Jul 27 '12 at 14:50

3 Answers3

2

Two likely things here:

1) is there a perl in a different path? Maybe it's run by hand from there.

2) your LD_LIBRARY_PATH equivalent is PERL5LIB. Check around and see if there's anything setting that.

after you get that figured out, time to start carving yourself a better paddle :) There are lots of options including building a complete library tree under a path and then using PERL5ENV on that, or even building your own standalone perl+libraries and invoking that in all your scripts.

Oh yeah - Solaris! I suspect it's running not-your-system-perl. Check for /opt/csw/bin/perl or similar. We do that on our one Solaris host - call the csw perl for stuff we want to run, and leave the system perl alone.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92
Bron Gondwana
  • 1,738
  • 3
  • 12
  • 15
1

How would you switch the current version? Is there something for Perl which is like virtualenv?

Yes, Perlbrew is a virtualenv equivalent for Perl.

Starfish
  • 2,716
  • 24
  • 28
0

Your best option is to use perlbrew, as pointed by starfish, and run the script in the new enviroment.

You can also install LWP::Simple in a local dir, say /home/falcon, and add the this line to the top of your script use lib '/home/falcon'; (as answered here)

aod
  • 36
  • 3