Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Can't find module error

by kirk123 (Beadle)
on Apr 15, 2003 at 18:39 UTC ( #250639=perlquestion: print w/ replies, xml ) Need Help??
kirk123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am getting a "Can't locate Find.pm in @INC (@INC contains: c:\h\coe\comp\perl\lib c:\perl\lib c:\perl\lib\site c:\perl 3. BEGIN failed--compilation aborted at dir.pl line 3." error. The find.pm is actually located in another directory(c:\h\COTS\Perl\lib\File). How can I update @INC to look there or is there a way I can specify the "use function" to look in another directory for Find.pm. --thanks

Comment on Can't find module error
Re: Can't find module error
by cbro (Pilgrim) on Apr 15, 2003 at 18:47 UTC
    Add:
    use lib 'c:\h\COTS\Perl\lib';
    To the top of your script to search for the module in a non standard directory(e.g. Those not specified in @INC).
    HTH,
    Chris
      Chris, It did not work. I am getting the following error"
      Can't locate lib.pm in @INC
      (@INC contains: c:\h\coe\comp\perl\lib\site c:\h\coe \comp\perl\lib c:\perl\lib c:\perl\lib\site c:\perl\lib\site .)
      at dir.pl line 3.
      BEGIN failed--compilation aborted at dir.pl line 3.
      "
      my scripts as follow:
      #!/h/COE/Comp/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"; }
      thanks

      2003-04-16 edit by ybiC: <tt> for error message, <code> for script

        Sorry to respond so late, but I was already gone by the time you responded. I doubt you'll still see this, but I'll check for updates regardless.

        Did arturo's response point you in the right direction? If not, do you have an update or still need help? Let us know if you're still stuck.

        Chris
Re: Can't find module error
by LAI (Hermit) on Apr 15, 2003 at 18:49 UTC

    The following:

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

    Should do what you want. This is the preferred interface to @INC, rather than modifying it directly.

    Update: It occurred to me that your entire perl distribution might be in C:\h\COTS. If so, you likely want to modify your installation of perl to reflect that. I'm not clear on where stuff is in Windows, but you likely have a Perl.ini or something like that, where the default @INC is defined. Append to (or replace) the directories in the .ini with your path, and it should be good.

    That is, assuming the machine is your own and doing the above wouldn't break anyone else's perl :)

    Update: Silly double-quotes. They're single now. Thanks, chromatic!

    LAI

    __END__
Re: Can't find module error
by arturo (Vicar) on Apr 15, 2003 at 18:51 UTC

    The problem is that the name of the module is File::Find, not just Find

    Since it is part of the standard Perl distribution, it will Just Work if you replace

    use Find;
    in your script with
    use File::Find;

    The reason is that Perl modules have name spaces, and the structure of these name spaces are reflected in directory structures; the "File" namespace is for modules deal with files and filesystems, and "Find" is one of the modules in that namespace. Thus, when you say use File::Find, perl searches for File/Find.pm in the directories in the @INC array. If you look in the directory where Find.pm resides, you'll see that there are all sorts of other files with names like Copy.pm, and at the top of every one of them will be a line that says package File::[filename];, where "filename" is the name of the file you're looking at minus its ".pm" extension.

    HTH

    If not P, what? Q maybe?
    "Sidney Morgenbesser"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://250639]
Approved by sschneid
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2014-09-30 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (364 votes), past polls