Expect.pm can't work [Fermé]

Signaler
Messages postés
69
Date d'inscription
jeudi 4 septembre 2014
Statut
Membre
Dernière intervention
18 mars 2016
-
Hi ,
after execution of my script , i have this message " Can't bless non-reference value at /usr/local/share/perl5/Expect.pm line 202. ", what would this mean , is there a solution , please helpp



   #!/usr/bin/perl
    use strict;
    use warnings;
    use Net::SSH::Perl;
    use Expect;
    my $mypass_ena="user"; 
    my $cmd="
    enable
    $mypass_ena
    show arp
    ";
    use constant { 
    host => '192.168.2.5',
    user => 'admin',
    pass => 'user',

    }; 
    my $ssh = Net::SSH::Perl->new(host)
        or die qq(can't ssh to host.);
    $ssh->login(user,pass);
    my ($stdout, $stderr, $exit) = $ssh->cmd("",$cmd);
    my $expect = Expect->init($stdout);
     $expect->raw_pty(1);
     #$expect->debug(2);
    my $debug and $expect->log_stdout(1);

     while(<$stdout>)
    { print "$. $_ "
      #$. $_->Load($fich);
     #my $a=print"$. $_ ";
     #print "$a";
      #rediriger_flux($fich);

    }