Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am getting this error, any help would be appreciated!

Status
Not open for further replies.

Stiddy

IS-IT--Management
Dec 5, 2001
781
US
Use of uninitialized value in subroutine entry at D:/Perl/lib/Socket.pm line 370
, <NAV> line 655.
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16 at D:/P
erl/lib/Socket.pm line 370, <NAV> line 655.


Here is the script I am using.

use File::Copy;
use Net::ping;
my $host = Net::ping->new("icmp");
#print_text();
gather_info();

##### Open logfiles for input and Read in machines to be evaluated #####
open (SIGNATURES, ">>d:\\scripts\\Symantec\\Check_wks_dates\\NAV_Sigs.log");
open (UNREACHABLE, ">>d:\\scripts\\Symantec\\Check_wks_dates\\UnReachable.log");
open (NAV, "<d:\\scripts\\Symantec\\Check_wks_dates\\All_DLS_Workstations.log") || die ("Cannot open All_DLS_Workstations.log: $!"); ##### Here is where you modify your list ####
while(<NAV>) {
chomp $_;
$_ =~ tr/a-z/A-Z/;
if ($host->ping($_, 5)){&wks}
else {
print "$_ unreachable\n";
print UNREACHABLE ("$_\n")}
}
close SIGNATURES;
close NAV;
$host->close();
#####################################################################

##### Compare <STDIN> Nav date with value on workstation #####
sub wks
{
if (-e "d:\\scripts\\Symantec\\Check_wks_dates\\wks.txt"){`del d:\\scripts\\Symantec\\Check_wks_dates\\wks.txt`;}
if (-e "\\\\$_\\tivoli\$\\progra~1\\common~1\\symant~1\\virusd~1\\definfo.dat"){copy ("\\\\$_\\tivoli\$\\progra~1\\common~1\\symant~1\\virusd~1\\definfo.dat","d:\\scripts\\Symantec\\Check_wks_dates\\wks.txt");}
$wks_cur_nav = `grep CurDefs= wks.txt | cut -c 9-22`; chomp $wks_cur_nav;
$wks_old_nav = `grep LastDefs= wks.txt | cut -c 10-22`; chomp $wks_old_nav;
print SIGNATURES "$_,$wks_cur_nav,$wks_old_nav,$cur_nav_sig\n";
print "$_\n";
}

##### Gather Information ########
sub gather_info
{
if (-e "d:\\scripts\\Symantec\\Check_wks_dates\\SAV_Server.txt"){`del d:\\scripts\\Symantec\\Check_wks_dates\\SAV_Server.txt`;}
if (-e "\\\\12.12.12.12\\c\$\\progra~1\\common~1\\symant~1\\virusd~1\\definfo.dat"){copy ("\\\\12.12.12.12\\c\$\\progra~1\\common~1\\symant~1\\virusd~1\\definfo.dat","d:\\scripts\\Symantec\\Check_wks_dates\\SAV_Server.txt");}
$cur_nav_sig = `grep CurDefs= SAV_Server.txt | cut -c 9-21`; chomp $cur_nav_sig;
}
 
by the way, the SAV_Server.txt, which changes daily but the format is consistant, would contain:
[DefDates]
CurDefs=20041013.032
LastDefs=20041011.007

And the wks.txt would be exact in format
 
I've done some checking, it is the Net::ping module.
Code:
use Socket qw( SOCK_DGRAM SOCK_STREAM SOCK_RAW PF_INET inet_aton inet_ntoa sockaddr_in );
Now think of where you have used a function from the Net::ping module...
 
Bytheway, are you using strict and warnings?
And please check the opening and closing of all files (for your own sake)
 
The only one I can find is the following one:
Code:
my $host = Net::Ping->new("icmp");
$host->ping($_, 5)
In the manual I see something of binding. Could it be that something like this is missing (I don't know this area well)
Code:
$host->bind($my_addr);
This is where I get my info from...
 
uida1154

I am using warnings. I have ran the script with the -c option and all seems to check out ok. What do you suggest about binding?
 
Like I said, I don't know much about this net stuff but I simply read the error and conclude that somehow the ping function is missing something which might be solved by a bind.

Summary: Someone else should pick up the help from here...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top