Programming and Scripting :: Perl question..



I am trying to get a Perl program to run.  The @INC global is pointing to another path than where my perl modules are.

The app updates my dynamic dns with my new ip.  

I installed XAMPP which comes with Perl.  

When I try to execute the perl app (perl ipUpdate.pl)

It comes back saying it Can't locates Sys::Hostname modules.  Then it has a bunch of paths.  none point to the

/opt/lampp/lib/perl5/5.8.7/    

I think this is kind of weird since XAMPP people include perl with their package, but didn't update the @INC global variable with their default.

How do I update the @INC or the perl5lib path with the correct on and keep it perment.?? Do I need to update an environment variable in Linux or something...

I think this is kind of weird since XAMPP people include perl with their package, but didn't update the @INC global variable with their default.

They did things correctly.  I think when you type perl, you wind up using the perl that comes with dsl.  If you want the xampp perl you need to specify the path.  Try this:

perl -e 'foreach(@INC){print "$_\n"}'

/etc/perl
/usr/local/lib/perl/5.8.0
/usr/local/share/perl/5.8.0
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8.0
/usr/share/perl/5.8.0
/usr/local/lib/site_perl
.

vs. adding the path before perl:

/opt/lampp/bin/perl -e 'foreach(@INC){print "$_\n"}'

/opt/lampp/lib/perl5/5.8.7/i686-linux
/opt/lampp/lib/perl5/5.8.7
/opt/lampp/lib/perl5/site_perl/5.8.7/i686-linux
/opt/lampp/lib/perl5/site_perl/5.8.7
/opt/lampp/lib/perl5/site_perl
.

I suppose you could always put the lampp directories at the front of your PATH variable and get the same result without always needing to add the paths.  You could type it in the shell you're working in.

export PATH=/opt/lampp/bin:$PATH

Now you'd get this happening :

perl -e 'foreach(@INC){print "$_\n"}'

/opt/lampp/lib/perl5/5.8.7/i686-linux
/opt/lampp/lib/perl5/5.8.7
/opt/lampp/lib/perl5/site_perl/5.8.7/i686-linux
/opt/lampp/lib/perl5/site_perl/5.8.7
/opt/lampp/lib/perl5/site_perl
.

That does what you want as well, but if it's just one or two lines why not leaves things like they are and add the path in front the few times you need to.

clacker,
   First off, thanks for replying.

Second, I had no idea perl came with DSL.  I am running DSL 2.3 on this machine I have as my web server.  

I guess it doesn't matter which perl I use.  

One thing I did do was look at one of the paths perl (I guess the DSL one) displayed and I copied the Hostname.pm to the directory, but still got the error.  

I will mess with it tonight, maybe I will have some luck now that you have helped.  

I will post my results.

Thanks


original here.