Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

`use lib' confusion

by mikeirw (Pilgrim)
on Nov 16, 2002 at 21:42 UTC ( #213453=perlquestion: print w/replies, xml ) Need Help??

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

Let's say I have placed 'SomeModule.pm' in '/home/mikeirw/lib/SomeDir' and do:

use lib '/home/mikeirw/lib'; use SomeDir::SomeModule;

... perl does not find the module. If I just place the module directly in '/home/mikeirw/lib', the module is found. Am I missing something here? perldoc lib doesn't reveal any clues.

Replies are listed 'Best First'.
Re: `use lib' confusion
by Aristotle (Chancellor) on Nov 16, 2002 at 22:04 UTC
    There's no obvious reason why it would be going wrong.. shot in the dark: if you're using this from a script that doesn't run under your UID (such as a CGI script), have you made sure the permissions on SomeDir are correct?

    Makeshifts last the longest.

      It is in fact a CGI script. The perms on all directories are 0755 and 0644 for the modules, so Apache can read them.

      Everything works if I move 'SomeModule.pm' to '/home/mikeirw/lib', and just do:

      use SomeModule;

      ...so the problem is that perl is not descending into 'SomeDir'.

        What happens if you
        use lib '/home/mikeirw/lib/SomeDir'; use SomeModule;
        ?

        Makeshifts last the longest.

Re: `use lib' confusion
by pg (Canon) on Nov 16, 2002 at 22:16 UTC
    I just tried what you described here, seems it is fine. Whatever you say,
    use lib '/a/b/c; use d::e;

    or,
    use lib '/a/b/c/d"; use e;

    must be something else.
Re: `use lib' confusion
by mikeirw (Pilgrim) on Nov 16, 2002 at 22:34 UTC

    Doh! I had rearranged some things and forgot to update the package statement. I think it's time to take a break. :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2023-06-04 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (17 votes). Check out past polls.

    Notices?