in reply to Every Perl Script Is Failing Compilation

Look like something has gotten botched up in @INC or %INC. In your first error message, with Spec.pm, in first few lines of that module:
use strict; use vars qw(@ISA $VERSION); $VERSION = '3.2501'; $VERSION = eval $VERSION;
If use vars doesn't work right, then $VERSION won't have package scope and you will get the type of message that you are seeing. vars.pm in Perl/lib does some major mojo. If this doesn't work, you are screwed! Try running the following and compare with your reference system.
print "INC PATHs\n"; foreach (@INC) { print "$_\n"; } print "\n\n"; print "INC HASH\n"; foreach (keys %INC) { print "$_ => $INC{$_}\n"; }
My Win XP box gives:
INC PATHs C:/Perl/site/lib C:/Perl/lib . INC HASH warnings/register.pm => C:/Perl/lib/warnings/register.pm bytes.pm => C:/Perl/lib/bytes.pm XSLoader.pm => C:/Perl/lib/XSLoader.pm Carp.pm => C:/Perl/lib/Carp.pm C:/Perl/site/lib/sitecustomize.pl => C:/Perl/site/lib/sitecustomize.pl Exporter.pm => C:/Perl/lib/Exporter.pm strict.pm => C:/Perl/lib/strict.pm warnings.pm => C:/Perl/lib/warnings.pm overload.pm => C:/Perl/lib/overload.pm Data/Dumper.pm => C:/Perl/lib/Data/Dumper.pm

Replies are listed 'Best First'.
Re^2: Every Perl Script Is Failing Compilation
by Anonymous Monk on Sep 03, 2009 at 14:04 UTC

    When you run the script, do you need to include 'use ...' to include any modules to show the HASH results? When I did, I got the same compilation errors as before, without them I get this:

    $ perl test.pl INC PATHs /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 . INC HASH

    As you can see, nothing is printed out for INC HASH. Bit of a catch 22 it seems...

      When you run the script, do you need to include 'use ...' to include any modules to show the HASH results?

      No, no "use" needed. I wrote my code in a simplistic way so that it didn't "require" or "use" any other modules.

      Again, as before, I suggest you compare output with your "reference system". I suspect that something is wrong with @INC and %INC.

      I don't know how to "fix" your problem, meaning how to correct the INC paths but other Monks may know. I asked that you compare this system versus the "reference system" that is working and you haven't provided that.

      I am wondering how you are getting along with this problem.

      You seem to have a LOT of stuff in the @INC path. Probably not an issue, but sometimes multiple versions can be trouble. I was not able to see immedidate problem with your command line stuff although there may be some file permission problems.

      I can replicate your first error message in the following code. As I mentioned before, "use vars(....);" appears in File::Spec. When vars.pm can't be found or "used" $VERSION doesn't have package scope.

      Anyway, start with simple code and then work from there. You have NO chance until you get this small program working:

      #!/usr/bin/perl -w use strict; use File::Spec; use vars qw(@ISA $VERSION); $VERSION = '3.2501'; print "Im ok if no warnings"; __END_ If I comment out: use vars qw(@ISA $VERSION); I get your error mesage: Global symbol "$VERSION" requires explicit package name at C:\TEMP\simple.pl line 8.
      At this point, I don't know how to help further. I can replicate your first error code in just a few lines of test code. Get stuff working from command line with you as the user. Then working from that, work on how to get Apache CGI server able to do the same thing.

      You may find this of help: http://perl.apache.org/docs/general/perl_reference/perl_reference.html#The__INC_array as well as Unix file permission (google on chmod).

        Hi there,

        The print out from the original test script you gave me is the output when I run it. I installed perl 5.10, and this gives me the same output, just with the single version for perl for the @INC paths (I installed it in a different location).

        The new installation has fixed all my problems for perl, as long as it is run from the new location (needing all the new modules etc). So when I run the simple code above, I get the same results as you. If I run it with the old version, I get the same error message as the second one from my original post, regardless of whether I have commented out the 'use vars qw(@ISA $VERSION)' line, so it is this line that is causing all the problems. I've had a look at all the file permissions from the @INC paths and they all seem ok. I've looked in all the paths that are thrown up in the error message, is there anywhere else I need to look, specifically for $VERSION? Carp.pm, File, File/Spec, and all the packages in these folders all have the correct permissions (-rw-r--r-- for .pm files, and drwxr-xr-x for folders, I'm assuming that these are all correct?)

        Thanks for your help

        I resulted to reinstalling perl 5.8, which has fixed all the problems. Seems one of the binaries got corrupted at some point, but it is all now working.

        Thanks for all your help