NAME
Mock::Net::Ping - Mock Net::Ping's ping method
SYNOPSIS
use Net::Ping;
require Mock::Net::Ping;
my $p = Net::Ping->new();
my $host = '127.0.0.1';
my ( $ok, $elapsed ) = $p->ping( $host );
printf "%s is %s reachable\n", $host, $ok ? '' : 'NOT';
$host = '10.10.10.10';
my ( $ok, $elapsed ) = $p->ping( $host );
printf "%s is %s reachable\n", $host, $ok ? '' : 'NOT';
DESCRIPTION
This module overrides Net::Ping::ping.
Functions
- $p->ping($host [, $timeout]);
-
Pretend to ping the remote host and wait for a response. $host can be either the hostname or the IP number of the remote host. The optional timeout must be greater than 0 seconds and defaults to whatever was specified when the ping object was created. Returns a success flag. If the host is localhost or 127.0.0.1, the success flag will be 1. For all other hosts, the success flag will be 0. In array context, the elapsed time as well as the host that was passed (except localhost will be converted to 127.0.0.1). The elapsed time value will be a float, as returned by the Time::HiRes::time() function.
ACKNOWLEDGEMENTS
This module would not exist without Net::Ping and the documentation is based heavily on that of Net::Ping itself.
AUTHOR
Matthew Musgrove <mr.muskrat@gmail.com>
COPYRIGHT
Copyright (c) 2014, Matthew Musgrove. All rights reserved.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.