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

Hi,
I'm trying to manually install few .pm modules into existing Perl 5.8.8 installation under Kubuntu 710.

But the problem is that when I run the script it doesn't find those .pm files, although they are in right place - maybe script is not looking at the right spot...

I have this in perl script: use Games::Rezrov::ZIO_Asterisk; # This is where all the callback routines are defined for use

and whem I run it, it reports error :
sudo -u asterisk ./zoip.agi /usr/share/asterisk/agi-bin/ZORK1.DAT Can't locate Games/Rezrov/ZIO_Asterisk.pm in @INC (@INC contains: /usr +/share/asterisk/agi-bin/lib /etc/perl /usr/local/lib/perl/5.8.8 /usr/ +local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/ +5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./zoip.agi lin +e 24, <DATA> line 256. BEGIN failed--compilation aborted at ./zoip.agi line 24, <DATA> line 2 +56.


although files seem to be there in right place :
ls -l /usr/local/share/perl/5.8.8/Games/Rezrov/ZIO_Asterisk.pm -rwxr-x--- 1 root root 9275 2008-09-26 02:07 /usr/local/share/perl/5.8 +.8/Games/Rezrov/ZIO_Asterisk.pm

What am I doing wrong ?

Thanks in advance,

regards,

Rob.

Replies are listed 'Best First'.
Re: Why Perl misses installed modules ?
by jethro (Monsignor) on Sep 26, 2008 at 01:27 UTC

    See the "-rwxr-x--- 1 root root" in front of ZIO_Asterisk.pm? This means that only user root and group root can read this file.

    To change this so that everyone, even user asterisk, can read this file:

    sudo chmod a+r /usr/local/share/perl/5.8.8/Games/Rezrov/ZIO_Asterisk.p +m

    Maybe the directories leading up to Asterisk.pm are not readable either:

    sudo chmod a+rx /usr/local/share/perl/5.8.8/Games/Rezrov sudo chmod a+rx /usr/local/share/perl/5.8.8/Games
      Hi,

      thanks for the tip. That solved particular problem...I thought this will help also in other cases, but I still get weird results (although am pretty much sure I'm wrong again)...

      I've change chmod a+r on other directories and files too, but still get error on other file:
      sudo -u asterisk ./zoip.agi /usr/share/asterisk/agi-bin/ZORK1.DAT Can't locate Asterisk/Games/Zork/StoryFile.pm in @INC (@INC contains: +/usr/share/asterisk/agi-bin/lib /etc/perl /usr/local/lib/perl/5.8.8 / +usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p +erl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./zoip.agi + line 18. BEGIN failed--compilation aborted at ./zoip.agi line 18.
      but I've checked path and file :
      # ls -l /usr/local/share/perl/5.8.8/Asterisk/Games/Zork/StoryFile.pm -rwxr-xr-- 1 root root 83289 2008-09-26 02:07 /usr/local/share/perl/5. +8.8/Asterisk/Games/Zork/StoryFile.pm dcerouter_79506:/usr/share/asterisk/agi-bin# ls -l /usr/local/share/pe +rl/5.8.8/Asterisk/Games/Zork total 124 -rwxr-xr-- 1 root root 83289 2008-09-26 02:07 StoryFile.pm -rwxr-xr-- 1 root root 14431 2008-09-26 02:07 ZInterpreter.pm -rwxr-xr-- 1 root root 9275 2008-09-26 02:07 ZIO_Asterisk.pm -rwxr-xr-- 1 root root 4932 2008-09-26 02:07 ZIO_StrippedDown.pm dcerouter_79506:/usr/share/asterisk/agi-bin# ls -l /usr/local/share/pe +rl/5.8.8/Asterisk/Games total 4 drwxr-xr-- 2 root root 4096 2008-09-26 02:07 Zork dcerouter_79506:/usr/share/asterisk/agi-bin# ls -l /usr/local/share/pe +rl/5.8.8/Asterisk total 44 -r--r--r-- 1 root root 13274 2003-08-07 20:04 AGI.pm drwxr-xr-- 3 root root 4096 2008-09-26 02:07 Games -r--r--r-- 1 root root 6193 2003-06-14 08:35 Manager.pm -r--r--r-- 1 root root 1968 2003-06-09 22:02 Outgoing.pm -r--r--r-- 1 root root 1138 2002-09-26 09:47 QCall.pm -r--r--r-- 1 root root 5533 2003-06-09 22:02 Voicemail.pm dcerouter_79506:/usr/share/asterisk/agi-bin# ls -l /usr/local/share/pe +rl/5.8.8 total 536 drwxrwxr-x 3 root root 4096 2008-07-02 17:50 App drwxr-xr-x 4 root root 4096 2008-07-02 17:54 Archive drwxr-xr-x 3 root root 4096 2008-09-26 02:07 Asterisk -r--r--r-- 1 root root 261 2003-08-07 20:23 Asterisk.pm drwxr-xr-x 3 root root 4096 2008-07-02 17:54 auto drwxr-xr-x 2 root root 4096 2008-07-02 17:54 Compress drwxr-xr-x 4 root root 4096 2008-07-02 17:58 CPAN -r--r--r-- 1 root root 443080 2007-11-11 12:45 CPAN.pm drwxrwxr-x 6 root root 4096 2008-07-02 17:51 ExtUtils drwxr-xr-x 3 root root 4096 2008-07-02 17:53 File drwxr-xr-x 3 root root 4096 2008-09-26 01:55 Games drwxr-xr-x 4 root root 4096 2008-07-02 17:54 IO drwxr-xr-x 3 root root 4096 2008-07-02 17:51 Module drwxr-xr-x 3 root root 4096 2008-07-02 17:55 Net drwxr-xr-x 3 root root 4096 2008-07-02 17:59 RRD drwxrwxr-x 4 root root 4096 2008-07-02 17:50 TAP drwxr-xr-x 3 root root 4096 2008-07-02 17:55 Term drwxrwxr-x 3 root root 4096 2008-07-02 17:56 Test drwxr-xr-x 4 root root 4096 2008-07-02 17:56 YAML -r--r--r-- 1 root root 23904 2007-09-27 10:45 YAML.pm


      It must be my mistake again, but have no clue what I did wrong...

      Thanks in advance,

      regards,

      Rob.


        Ah, the mysteries of unix file permissions ;-). Check out the chmod lines in my previous answer. I used a+r for the file, but a+rx for the directories.

        For a directory the flags r and x have different meaning than for files. The r-flag allows access to files in the directory (if you already know the name). The x-flag allows you to read or search the directory. So except for special cases you normally want both flags either on or off

        In your case both Games and Zork need another x.