kirk123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi

Earlier someone suggest I use "use lib 'c:\h\COTS\Perl\lib'; in my code to overcome an error" can't locate File/Find.pm in @INC (@INC contains: c:\h\coe\comp\perl\lib\site c:\h comp\perl\lib c:\perl\lib c:\perl\lib\site c:\perl\lib\site .) at dir.pl li EGIN failed--compilation aborted at dir.pl line 3."

Well it did not work. I still could use some help. Here is my code:

#!/h/COE/Perl/bin/perl use lib 'c:\h\COTS\Perl\lib'; use File::Find; find(\&wanted,'/h', '/h/COE' ); sub wanted{ -d $_ && print "$File::Find::name\n"; }
The Find.pm is actually located in "c:\h\COTS\Perl\lib\File"

Replies are listed 'Best First'.
Re: Stuck with can't find module error
by chromatic (Archbishop) on Apr 15, 2003 at 22:30 UTC

    The problem with backslashes is that they can be interpreted as the start of escape sequences. Either double them, or use forward slashes. I prefer the latter, but either of these might work:

    use lib 'c:\\h\\COTS\\Perl\\lib'; use lib 'c:/h/COTS/Perl/lib';

    As a side note, it's can be considered a bit rude to start a new question instead of posting a followup to a previous question. If you're in a real fix, you might ask in the chatterbox to see if anyone can give you a hand.

      I agree completely with the advice. But in this specific case, 'c:\h\COTS\Perl\lib' eq 'c:\\h\\COTS\\Perl\\lib', so this is not the source of the problem.

      The reason I agree with the advice is that using strings like 'c:\h\COTS' often leads to mistakes such as using a string like 'c:\h\COTS\' (which will probably be a syntax error, depending on what comes after it) or '\\server\share' (which has a value of \server\share, containing only a single opening backslash).

                      - tye
Re: Stuck with can't find module error
by cLive ;-) (Prior) on Apr 15, 2003 at 22:29 UTC
    @INC doesn't contain c:\h\COTS\Perl\lib

    Your error message says at line 3 and the use File::Find is at line 4. Are you sure you've pasted *exactly* what is in your script?

    Whittle the code down to a smallest possible failure example and then repost - here - NOT in a new thread please! (hint, you can probably stop at the Use File::Find line).

    Perhaps in your script the two 'use' lines are the other way round? Hummm?

    cLive ;-)