Fairly new to perl, and even programming in general.

 When I try to have this program it to a large number of pings (anything
over about 200) it times out.  There is a built in feature to
Net::Telnet::Cisco to change the Timeout value, but I can't seem to get it
coded correctly.

http://search.cpan.org/author/JOSHUA/Net-Telnet-Cisco-1.10/Cisco.pm

shows this

    $ok = $obj->cmd($string);
    $ok = $obj->cmd(String   => $string,
                    [Output  => $ref,]
                    [Prompt  => $match,]
                    [Timeout => $secs,]
                    [Cmd_remove_mode => $mode,]);

    @output = $obj->cmd($string);
    @output = $obj->cmd(String   => $string,
                        [Output  => $ref,]
                        [Prompt  => $match,]
                        [Timeout => $secs,]
                        [Cmd_remove_mode => $mode,]
                        [Normalize_cmd => $boolean,]);

#################################################

use strict;
use warnings;
use Net::Telnet::Cisco;

my $protocol  = '';
my $ip       = "$ARGV[1]";
my $repeat    = "$ARGV[0]";
my $datagram  = '';
my $timeout   = '';
my $extended  = '';
my $sweep     = '';

my $session = Net::Telnet::Cisco->new(host => '10.0.0.1') or die "Can not
connect to host0";
$session->login('Password','password') or die "1";
$session->enable('enablepass') or die "2";
my @output = $session->cmd(

    "ping
    $protocol
    $ip
    $repeat
    $datagram
    $timeout
    $extended
    $sweep
    ");
foreach (@output) {
    if ($_ =~ /Success/){
        print $_;
    }
}

####################################

adding

$session->cmd(Timeout => 3600);
my @output = $session->cmd(

gives no error but doesn't help, while

my @output = $session->cmd(
    Timeout => 3600,
    "ping

gives me the error

usage: $obj->cmd([Cmd_remove => $boolean,] [Output => $ref,] [Prompt =>
$match,]
 [String => $string,] [Timeout => $secs,]) at C:\x\PingR.pl line 16




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to