[clug] Perl @INC and finding modules weirdness

Michael Cohen scudette at gmail.com
Thu Mar 4 07:15:22 MST 2010


Hal
  A good debugging technique here is to run it with strace

strace -e open perl myscript.pl

or you can drop the -e open to see absolutely every system call.
redirect to a file and then search for the module its looking for -
you will be able to tell how its trying to open it, where its looking
for it and if there was some error opening it.

Michael.

On Fri, Mar 5, 2010 at 1:09 AM, Hal Ashburner <hal.ashburner at gmail.com> wrote:
> I have perl error that is taking the mickey out of me.
>
> Can't locate Foo/Bar/Baz.pm in @INC (@INC contains: /usr/bin/..
> /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
> /usr/local/lib/perl5/site_perl/5.10.0
> /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
> /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
> /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0
> /usr/lib/perl5/site_perl . ) at /usr/lib/perl5/site_perl/foo_bar.pl line 3.
>
> Foo/Bar/Baz.pm is right there in /usr/lib/perl5/site_perl/
>
> It's being called by something.pl also in /usr/lib/perl5/site_perl, it calls
> it in an orthodox fashion, ie:
>
> use Foo::Bar::Baz;
>
>
> Confusing, so I thought I'd kick off the script with
> push @INC, /usr/lib/perl5/site_perl/Foo/Bar/Baz.pm;
> Just to poke cruel fun at the perl message because I'm nothing if not petty
> when it comes to inanimate objects being disobedient. It's not comforting me
> as much as I'd hoped.
>
> Can't locate Foo/Bar/Baz.pm in @INC (@INC contains: /usr/bin/..
> /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
> /usr/local/lib/perl5/site_perl/5.10.0
> /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
> /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
> /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0
> /usr/lib/perl5/site_perl . /usr/lib/perl5/site_perl/Foo/Bar/Baz.pm) at
> /usr/lib/perl5/site_perl/foo_bar.pl line 3.
>
> Any clues as to why it can't locate a file in @INC then when it tells me the
> content of @INC explicitly lists the file?
> Permissions look ok to me but could that be it? I think I'm comfortable in
> calling the error message "misleadling".
>
> This is fedora core 11 with SELinux switched off in case that's somehow
> important. The code runs happily enough on debian stable.
>
> Cheers,
> Hal
>
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
>


More information about the linux mailing list