Search code examples
perlinitializationpar

Use of uninitialized value in do "file" at "path" PAR.pm line 636


I used Net::SSH::Perl to ssh to server and send command and collect the information. The script works fine when i execute it using perl ssh.pl But when I create standalone binary in redhat linux and execute the script is throwing the below warning

"Use of uninitialized value in do "file" at HOMEPATH/perl_modules/lib/site_perl/5.14.2/PAR.pm line 636" strong text

!/usr/local/bin/perl
use strict;
$| =1;
use warnings;
use Net::SSH::Perl;
$hostname = "******";
my $username = "*******";
my $password = "********";

my $cmd = "ps -ef | grep *** | grep -v grep";

my $ssh = Net::SSH::Perl->new("$hostname", debug=>0);
$ssh->login("$username","$password");
my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");
print $stdout;

Solution

  • This warning is harmless (and not caused by the specific Perl script shown). It is only generated on Perl 5.14.x, all other versions >= 5.8.1 are fine with this.