MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
October
Sun Mon Tue Wed Thu Fri Sat
 
26
     
2007
Months
Oct


Fri, Oct 26, 2007 5:32 pm

Perl ReadKey Module for ibmonitor

I tried installing ibmonitor using the ibmonitor-1.4-1.noarch.rpm RPM file I obtained from ftp://download.fedora.redhat.com/pub/fedora/linux/extras/6/i386. However, when I tried to install it, I got a message indicating the Term::Readkey module was missing.

# rpm --install ibmonitor-1.4-1.noarch.rpm
warning: ibmonitor-1.4-1.noarch.rpm: V3 DSA signature: NOKEY, key ID 1ac70ce6
error: Failed dependencies:
        perl(Term::ReadKey) is needed by ibmonitor-1.4-1
# perldoc -l Term::ReadKey
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm

But when I used the perldoc -l command to check on whether all of the required modules for ibmonitor were present, I saw it listed.

$ perldoc -l Term::ANSIColor
/usr/lib/perl5/5.8.0/Term/ANSIColor.pm
$ perldoc -l Term::ReadKey
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm
$ perldoc -l Time::HiRes
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Time/HiRes.pm

I also saw it listed when I used the find-modules.pl script I have on the system.

# ./find-modules.pl | grep -i ReadKey
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm

When I used the one-line Perl command perl -MTerm::ReadKey -el Perl did not complain. Nor did it complain when I tried perl -e 'use Term::ReadKey;'. If the module wasn't found by Perl it should complain it couldn't locate the module anywhere when I used either command.

And when I used the List Perl Modules CGI script, I have on the system, I also saw it listed there. So I didn't know why I got the message indicating the module is missing when I tried to install ibmonitor.

I used the locate command to look for any other occurrences of the file ReadKey.pm on the system, which showed the following.

# locate ReadKey.pm
/root/.cpan/build/TermReadKey-2.21/ReadKey.pm
/root/.cpan/build/TermReadKey-2.21/blib/lib/Term/ReadKey.pm
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm

I decided to try downloading and installing the module again through CPAN.

# perl -MCPAN -e shell
Undefined value assigned to typeglob at (eval 14) line 15,  line 11.
Warning [/etc/inputrc line 11]:
  Invalid variable `mark-symlinked-directories'

cpan shell -- CPAN exploration and modules installation (v1.76)
ReadLine support enabled

cpan> install Term::ReadKey
PAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Thu, 24 Nov 2005 14:54:20 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  ftp://archive.progeny.com/CPAN/authors/01mailrc.txt.gz
LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: timeout]
Fetching with Net::FTP:
  ftp://archive.progeny.com/CPAN/authors/01mailrc.txt.gz
Fetching with LWP:
  ftp://carroll.cac.psu.edu/pub/CPAN/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Fetching with LWP:
  ftp://archive.progeny.com/CPAN/modules/02packages.details.txt.gz
LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: timeout]
Fetching with Net::FTP:
  ftp://archive.progeny.com/CPAN/modules/02packages.details.txt.gz
<text snipped>
  /usr/bin/make test -- OK
Running make install
Installing /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Term/ReadKey/ReadKey.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Term/ReadKey.pm
Installing /usr/share/man/man3/Term::ReadKey.3pm
Writing /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Term/ReadKey/.packlist
Appending installation info to /usr/lib/perl5/5.8.0/i386-linux-thread-multi/perllocal.pod
  /usr/bin/make install  -- OK

cpan> exit
No history written (no histfile specified).
Lockfile removed.

Installing the later version of ReadKey.pm didn't help, though. I still got the same error message when I tried to install ibmonitor.

# rpm --install ibmonitor-1.4-1.noarch.rpm
warning: ibmonitor-1.4-1.noarch.rpm: V3 DSA signature: NOKEY, key ID 1ac70ce6
error: Failed dependencies:
        perl(Term::ReadKey) is needed by ibmonitor-1.4-1

I downloaded the src.rpm file, ibmonitor-1.4-1.src.rpm . Installed it with rpm --install ibmonitor-1.4-1.src.rpm, which created two files: usr/src/redhat/SOURCES/ibmonitor-1.4.tar.gz and /usr/src/redhat/SPECS/ibmonitor.spec. When I checked the ibmonitor.spec file, I found the following line in the spec file:

Requires:       perl(Term::ReadKey)

The Term::ReadKey module is only needed for ibmonitor fo changing the display on the fly by hitting certain keys, e.g. "m" to show the maximum bandwidth used while the program has been running. The program, which is a Perl script, will run without ReadKey support being present on the system. There is code within the script that checks for the presence of the module, but doesn't require it to be present. That code is shown below.

# Check for installation of Term-ReadKey module
eval q/use Term::ReadKey;/;
if (!$@) {
        $useReadKey = 1;
}

Since the module is actually present on the system and I can change the ibmonitor display by hitting the keys that trigger options in the program, such as the display of maximum bandwidth, I used rpm --nodeps --install ibmonitor-1.4-1.noarch.rpm to ignore the dependency check for Term::ReadKey and proceed with the installation of the ibmonitor RPM file. The program worked fine after the installation.

The RPM installation installs the following files:

$ ls -l /usr/share/doc/ibmonitor-1.4/
total 44
-rw-r--r--    1 root     root           33 Oct 13  2006 AUTHORS
-rw-r--r--    1 root     root         4260 Oct 13  2006 ChangeLog
-rw-r--r--    1 root     root        18009 May  3  2003 COPYING
-rw-r--r--    1 root     root         5477 Oct 13  2006 README
-rw-r--r--    1 root     root           67 Oct 13  2006 TODO
$ ls -l /usr/bin/ibmonitor
-rwxr-xr-x    1 root     root        31971 Oct 13  2006 /usr/bin/ibmonitor

References:

  1. How do I find which modules are installed on my system?
    perlfaq3 - perldoc.perl.org

  2. Chapter 10. Advanced RPM Packaging
    Fedora Documentation on docs.fedoraproject.org

  3. Chapter 22. Spec File Syntax
    Fedora Documentation on docs.fedoraproject.org

  4. [COMMIT LOGREPORT] package/rpm/SPECS lire.spec,1.26,1.27
    By: Wytze van der Raay wraay at users.sourceforge.net
    Date: August 4, 2006
    lists.logreport.org Mailing Lists

  5. Spec file tags
    Date: July 2, 2005
    Wraptastic

[/languages/perl] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo