I'm writing a simple motd-script in perl, that parses messages from specific websites and displays them in the center of the terminal screen.
To get the width of the terminal I use the CPAN module Term::ReadKey.
Now I am calling this script with
command /path/to/script
from my .bashrc
to display it on login and opening a terminal.
My script works fine when called while I'm logged in via perl or using
source .bashrc
but on the initial opening of a terminal (which is the actual purpose of the script) I'm getting this Error message:
Can't locate Term/ReadKey.pm in @INC (you may need to install the Term::ReadKey module) (@INC contains: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl .) at /path/to/perl-motd.pl line 6.
BEGIN failed--compilation aborted at /path/to/perl-motd.pl line 6.
Line 6 of the script is
use Term::ReadKey;
First find where that module is installed: locate Term/ReadKey.pm
If it's not found, you have to install it (may require sudo): cpan Term::ReadKey
If it is already installed, you have to tell Perl where it is:
use lib '/path/to'; # assuming it's installed as "/path/to/Term/ReadKey.pm"
use Term::ReadKey;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With