http://qs1969.pair.com?node_id=213453

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. :)