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

Hi Monks, I am trying to acees the remote server by using net::Telnet module.
#!/bin/perl -w use Net::Telnet; $telnet=new::Telnet(Timeout=>60,Error=>'die',Prompt=>'/ksh\$ $/i'); $telnet->open('192.168.10.220'); $telnet->login('patil','patil'); @lines = $telnet->cmd('who'); print "@lines\n";
After runnig this program its giving an error as 'undefined subroutine &new::telnet called at line 3. Suggest me so, that i can proceed further in my work.

Replies are listed 'Best First'.
Re: Telnet connection problem
by marto (Cardinal) on Jun 23, 2006 at 09:53 UTC
    Anonymous Monk,

    Take a look at the Net::Telnet documentation:

    use Net::Telnet; $telnet=new::Telnet(Timeout=>60,Error=>'die',Prompt=>'/ksh\$ $/i');
    should be
    use Net::Telnet(); $telnet = new Net::Telnet (Timeout => 60, Error=>'die', Prompt => '/ks +h\$ $/i');

    Hope this helps.

    Martin
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Telnet connection problem
by Hue-Bond (Priest) on Jun 23, 2006 at 09:48 UTC

    You may want to try using Net::Telnet::new or Net::Telnet->new ;^).

    --
    David Serrano