Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

use of telnet in perl

by varalaxmibbnl (Acolyte)
on Sep 13, 2013 at 07:22 UTC ( #1053852=perlquestion: print w/replies, xml ) Need Help??
varalaxmibbnl has asked for the wisdom of the Perl Monks concerning the following question:

if i run this code i get (Can't locate Net/ in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at line 2. BEGIN failed--compilation aborted at line 2. ) this error plz help me out to solve this problem...

#!/usr/bin/perl use Net::Telnet; $host = ""; $port = "23"; $uid = "xxxxx"; $pwd = "xxxx"; open $inputLog, ">in.log"; $box = new Net::Telnet(); $box->open( Host => $host, Port => $port, ); $iLog = $box->input_log($inputLog); $flag = $box->login( Name => $uid, Password => $pwd, ); $box->print("show log"); $box->waitfor('/# $/i'); $box->close; exit

Replies are listed 'Best First'.
Re: use of telnet in perl
by rminner (Chaplain) on Sep 13, 2013 at 07:49 UTC
    Sorry for this question, but did you already install Net::Telnet? Without installing it, it won't work.
    If you tell us which Unix/Linux you are trying to execute this on, then we could help you with the command for installing this module. Do you have root privileges on this machine?
    In case Net::Telnet isn't installed yet:
      thanks for ur reply... I'm working on linux ubuntu plz help me..
        Assuming you have root privileges the following command will probably work (untested):
        sudo apt-get install libnet-telnet-perl
Re: use of telnet in perl
by ansh batra (Friar) on Sep 13, 2013 at 08:26 UTC

    Can't locate Module/ in @INC
    This would always mean that the module is not installed on your machine

      always mean that the module is not installed on your machine case there's only a single perl installation and a single user using it and in short: in case it can be ruled out that the module was installed somewhere outside the current @INC paths.

      Cheers, Sören

      Créateur des bugs mobiles - let loose once, run everywhere.
      (hooked on the Perl Programming language)

        thanks for the correction

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1053852]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-05-23 08:15 GMT
Find Nodes?
    Voting Booth?