Well, it means that your installation of the Win32Win32::API-module is corrupt. Under windows, "loadable objects" are .dll-files that ship with your module. They have to be in "../perl/site/lib/auto/Module/Module.dll". I guess your Win32.dll Api.dll is missing.
| [reply] [Watch: Dir/Any] |
Hi,
Thanks to all those who helped my try and solve my problem. I still cant seem to get it working because i cant install the Win32::API correctly (i think it's because of the firewall).
Any ways, i am trying to ping a network and print the output to a file and then insert the results into a database. I have modified the script to do it without the Win32::API module, but i have the following error. sorry i am new to perl and this forum.
i get the following error: use of uninitialised value in concatenation (.) or string line 73.
#!/usr/local/bin/perl
use strict;
use Win32::ODBC; # Enables ODBC database connectivity
my $dsn = "postdev";
my $user = "archnas";
my $password = "something";
# Get all process related data from the database
# Declare Variables
my $rc;
my $sql;
my @ip;
my $file100 = "c:/temp/ping100.log";
my $file200 = "c:/temp/ping200.log";
# Open ODBC session to database
my($odbc_session) = new Win32::ODBC("dsn=$dsn; uid=$user; pwd=$passwor
+d;") or die "Error connecting to $dsn\n";
# SQL
$sql = "
select DWH_LAN_IP
FROM
DAPO_CPCT_MGMT.DWH_Ntwk_Adr
WHERE DWH_Ping_Flg = 'Y'
";
# Submit SQL
$rc = $odbc_session->Sql("$sql");
# Check for SQL errors
if(defined $rc)
{
my $sql_error = $odbc_session->Error;
my @sql_error = split /([-\[\]"])/,$sql_error;
print "$sql\n";
print "SQL error: @sql_error[4,-2]\n";
exit;
}
# Retrieve answerset
while($odbc_session->FetchRow())
{
# Stores each IP Address in the @ip.
my $ip_add = $odbc_session->Data();
#print "$ip_add\n";
push @ip, $ip_add; # Pushes each IP Address in the @ip to the top.
+
}
foreach (@ip) { my $cmd1 = "ping -n 4 -l 100 $_> $file100"; # Ping cou
+nt, interval and packetsize of 100 for the IP Address. Read out to lo
+g file.
print "$cmd1\n";
system ($cmd1);
my $cmd2 = "ping -n 4 -l 200 $_> $file200"; # Ping count, inte
+rval and packetsize of 200 for the IP Address. Read out ot log file.
system ($cmd2);
open(FILE100, "$file100") || die "Could not open file $file100:$!\
+n";
my @file100 = <FILE100>;
close(FILE100);
open(FILE200, "$file200") || die "Could not open file $file200:$!\
+n";
my @file200 = <FILE200>;
close(FILE200);
print "$file100[9]\n $file100[11]\n";
print "$file200[9]\n $file200[11]\n";
#file100 is the variable holding the values to match on.
$file100[9] =~ m/(^.*Sent\s=\s)(.*?)(\s,Received\s=\s)(.+?)(\s,Lost\s=
+\s)(.??)(\s.*$)/;
my $sent = $2;
my $received = $4;
my $lost = $6;
print "$sent, $received, $lost\n";
#$file100[9] =~ m/(^.*Sent\s=\s)(.*?)(,.*)/;
#print ";$1;, ;$2;\n";
#$file100[11]=~ m/^.*Minimum\s=\s(.*)\s,Maximum\s=\s(.*)\s,Average\s=\
+s(.*)\s.*$/;
#my $min = $1;
#my $max = $2;
#my $avg = $3;
#print "$min, $max, $avg\n";
exit;
}
| [reply] [Watch: Dir/Any] [d/l] |
use Win32::API;
? | [reply] [Watch: Dir/Any] [d/l] |
at c:/Perl/site/lib/Win32/PingICMP.pm line 16:
use Win32::API;
| [reply] [Watch: Dir/Any] [d/l] |
Yeah, you're right. I should have written Do you have Win32::API installed on your system? I don't think it is included by default.
| [reply] [Watch: Dir/Any] |