Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-26 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found