Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Can't locate AMOS/AmosLib.pm in @INC

by Jeri (Scribe)
on May 18, 2012 at 15:22 UTC ( #971327=perlquestion: print w/ replies, xml ) Need Help??
Jeri has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks! My perl module AmosLib.pm cannot be found, but it is definitely installed on my computer. Here I verify it.
jdilts@jdilts-VirtualBox:~$ sudo find ./ -name "AmosLib.*" [sudo] password for jdilts: ./.local/share/Trash/files/bin/amos-3.1.0-rc1/src/PerlModules/AmosLib. +pm ./.local/share/Trash/files/src/PerlModules/AmosLib.pm
The strange part is when I do a search in the GUI over my whole file system. It also finds two instances of AmosLib.pm, but not in the same location.
/usr/local/bin/amos-3.1.0-rc1/lib/AMOS
/usr/local/bin/amos-3.1.0-rc1/src/PerlModules

When I run my script I get this error.
Can't locate AMOS/AmosLib.pm in @INC (@INC contains: /etc/perl /usr/lo +cal/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/ +share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/si +te_perl .) at /usr/local/bin/amos-3.1.0-rc1/src/Converters/tarchive2a +mos.pl line 5. BEGIN failed--compilation aborted at /usr/local/bin/amos-3.1.0-rc1/src +/Converters/tarchive2amos.pl line 5.
It seems my program wants to find AmosLib.pm in the AMOS directory which was found by my GUI search and not by the terminal find command. So, I decided to do an export to that directory and I look at my PERL5LIB path.
jdilts@jdilts-VirtualBox:~$ export PERL5LIB=/usr/local/bin/amos-3.1.0- +rc1/lib/AMOS:$PERL5LIB jdilts@jdilts-VirtualBox:~$echo $PERL5LIB /usr/local/bin/amos-3.1.0-rc1/lib/AMOS:/usr/local/bin/amos-3.1.0-rc1/s +rc/PerlModules:/home/jdilts/perl5/lib/perl5/i686-linux-gnu-thread-mul +ti-64int:/home/jdilts/perl5/lib/perl5
Okay good. Now my script should work, but no. I get the same error and don't see the directory I inserted into the PERL5LIB.
Can't locate AMOS/AmosLib.pm in @INC (@INC contains: /etc/perl /usr/lo +cal/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/ +share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/si +te_perl .) at /usr/local/bin/amos-3.1.0-rc1/src/Converters/tarchive2a +mos.pl line 5. BEGIN failed--compilation aborted at /usr/local/bin/amos-3.1.0-rc1/src +/Converters/tarchive2amos.pl line
I'm not sure what I'm doing wrong. All help is greatly appreciated! Thanks!

Comment on Can't locate AMOS/AmosLib.pm in @INC
Select or Download Code
Replies are listed 'Best First'.
Re: Can't locate AMOS/AmosLib.pm in @INC
by toolic (Bishop) on May 18, 2012 at 15:28 UTC
    If your AmosLib.pm file declares package AMOS::AmosLib;, then change:
    export PERL5LIB=/usr/local/bin/amos-3.1.0-rc1/lib/AMOS:$PERL5LIB

    to:

    export PERL5LIB=/usr/local/bin/amos-3.1.0-rc1/lib:$PERL5LIB

    See also: Simple Module Tutorial and require

      Okay. I checked the file. It was AMOS::AmosLib like you suspected. So I changed the export and got the same error with no change. I also tried putting the .pm in the /etc/perl directory.
        Create a new script with just these lines in it:
        #!/usr/bin/env perl use Data::Dumper; print Dumper(\@INC); print "$_\n" for glob '/usr/local/bin/amos-3.1.0-rc1/lib'
        Run it and post the results in readmore tags.
        I also tried putting the .pm in the /etc/perl directory.

        Did you put AmosLib.pm in /etc/perl/AMOS/?


        Improve your skills with Modern Perl: the free book.

        Honestly, I'm not trying to be a burden. I just need to know how to get a path I want into @INC. Thanks!
Re: Can't locate AMOS/AmosLib.pm in @INC
by runrig (Abbot) on May 18, 2012 at 18:56 UTC
    With PERL5LIB set, run perl -V. is there an AMOS directory in one of the directories listed in the @INC list at the end? Does that directory contain AmosLib.pm? Is the AMOS directory and the AmosLib.pm file readable by you? Does perldoc -m AMOS::AmosLib find the AmosLib.pm source?
Re: Can't locate AMOS/AmosLib.pm in @INC
by Eliya (Vicar) on May 18, 2012 at 16:43 UTC
    ...and don't see the directory I inserted into the PERL5LIB

    Did you run the Perl script from the same shell where you exported PERL5LIB?

      yes

        Well, if this is true, your perl is broken :)  Or your script resets @INC.  Or your script runs in taint mode (-T).  Or you showed the wrong error message in your OP.

        Items in PERL5LIB should otherwise always appear in the reported @INC:

        $ PERL5LIB=/foo/bar perl -MNot::Exist -e1 Can't locate Not/Exist.pm in @INC (@INC contains: /foo/bar /etc/perl / +usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 + /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/ +lib/site_perl .). BEGIN failed--compilation aborted.

        As you can see, /foo/bar has been added to @INC.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2015-07-29 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls