in reply to getting ping output using Net::Ping

There are five parts to the output:
  1. Number of bytes sent
  2. host to contact
  3. sequence number
  4. ttl
  5. time it took
You can set the first two when you call Net::Ping so those are known. You can compute number 5 roughly by timing the call to ping. Number 3 is mostly to tell you about lost and out of order packets -- it is not returned by Net::Ping nor is number 4. What info do you really need?

HTH, --traveler

Replies are listed 'Best First'.
Re: Re: getting ping output using Net::Ping
by nick (Sexton) on Dec 18, 2001 at 05:03 UTC
    I guess the important bit is #5. I'd like be able to say it took X ms. How do I time a call to a method? I have never done that before.
    - Nick
    
      use Time::HiRes 'time'; my $before=time(); #do stuff here my $after=time(); my $howlong=$after-$before;
      Note, however, that Time::HiRes returns the time in floating-point seconds, not milliseconds.

      =cut
      --Brent Dax
      There is no sig.