Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

@INC Errors

by perl.j (Pilgrim)
on Oct 09, 2011 at 02:43 UTC ( #930403=perlquestion: print w/replies, xml ) Need Help??
perl.j has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

When I got on my PC today I found an unpleasant surprise. Every day, the first Perl Program I run is a very simple one to make sure everything is working smoothly:

use 5.12.4; use strict; use warnings; my $greeting="Hello, World"; print $greeting;

Today however, things did not go as planned. I got the following error when trying to run the program: Can't locate strict.pm in @INC (@INC contains: .). @INC did not used to contain a ".". What happened here and how can I fix this?

Thanks

--perl.j

Replies are listed 'Best First'.
Re: @INC Errors
by chromatic (Archbishop) on Oct 09, 2011 at 02:50 UTC

    @INC normally contains ., unless running in taint mode. @INC should never only contain ., which appears to be your problem. Something changed in your environment.


    Improve your skills with Modern Perl: the free book.

      This problem would be caused by an inability to access Perl's library directories. Maybe you don't have permission anymore, or maybe the directories are gone.

        Does perl remove from @INC at startup (or module load time) if it can't stat those directories? I've never seen that. Clever.


        Improve your skills with Modern Perl: the free book.

      So how do I fix it?
      --perl.j

        Figure out what changed in your environment. Check that the directories in perl -V exist and have permissions which allow you to read them.


        Improve your skills with Modern Perl: the free book.

Re: @INC Errors
by Khen1950fx (Canon) on Oct 09, 2011 at 03:44 UTC
    You can check @INC using a one-liner:
    perl -e 'print join "\n", @INC';
    Or simply run:
    perl -V
    The "." stands for the current directory; hence, it will always come last in the list. Here's a little snippet that I used a couple of years ago. I was experimenting with chromatic's Modern::Perl. It'll enable strict, warnings, and features.
    #!perl use Modern::Perl; use File::PathList; use Data::Dumper::Concise; my $inc = File::PathList->new( paths => \@INC ); say Dumper $inc;
    That was just to satisfy my obsession with Dumper:). You should also check to make sure that perl's in your path.

      You can check @INC using a one-liner:

      The error message already show the contents of @INC

      Or simply run: perl -V

      How do you think perl -V would work if @INC is empty and strict can't be found?

      You should also check to make sure that perl's in your path

      When perl gives you error messages, that means perl is in the path

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://930403]
Approved by toolic
help
Chatterbox?
[Corion]: I usually expect fixed header names, but am sometimes lenient in the order of columns. But changing the report titles often sounds to me as if you are not the sole consument of the export ;)
[shmem]: perldigious: as always - if it ain't broke, don't fix it. Ther must be a very compelling reason for changing column names in a database. Those are rare.
[Corion]: If you have whitespace in the column names in the database, whap the DBAs ;)
[shmem]: It's common for some vendors to have column names such as WRSTVG or some other such whizzbang, and another table where these names are mapped to something meaningful depending on how you look at the data
[shmem]: afair in SAP that occurs all the time

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-05-25 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?