Hi, In the following code I am using the Win32::PingICMP module to ping IP Addresses and print the roundtrip times. However, when I run the code I get the following error: Can't locate loadable object for module Win32::API in @INC <@INC contains: c:/Perl/lib/ c:/Perl/site/lib/.> at c:/Perl/site/lib/Win32/PingICMP.pm line 16. BEGIN failed -- compilation aborted at c:/Perl/site/lib/Win32/PingICMP.pm line 16. I have saved all the appropriate modules in the right directories as well. I would greatly appreciate it if someone could help me out here. Thanks. A.
#!/usr/local/bin/perl use strict; use Win32::ODBC; # Enables ODBC database connectivity use Win32::PingICMP; 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; # 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. + } print map {"$_\n"} @ip; my $p = Win32::PingICMP->new(); foreach (@ip) {my $ping = $p->ping($_, 5); if ($ping == 1){ $rtime = $p->details->{roundtriptime}; } else {$rtime = 0;} print "ping of $_ took $rtime ms\n"; } $p->close();

In reply to Problem with Win32::PingICMP and Win32::API by as :)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.