| 1 | package Net::Async::Ping; | ||||||||||||||||||||||||||
| 2 | 1 | $Net::Async::Ping::VERSION = '0.001001'; | |||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||
| 6 | # ABSTRACT: asyncronously check remote host for reachability | ||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Module::Runtime 'use_module'; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 9 | 1 | ▶ | use namespace::clean; | ||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||
| 11 | 1 | my %method_map = ( | |||||||||||||||||||||||||
| 12 | tcp => 'TCP', | ||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||
| 15 | sub new { | ||||||||||||||||||||||||||
| 16 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=25.5
Pod
documented
| |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||
| 18 | 1 | ▶ | my $method = shift || 'tcp'; | ||||||||||||||||||||||||
|
Condition50%1/2
shift() || 'tcp'
MC/DC0%0/1
shift() || 'tcp'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||
| 20 | die "The '$method' proto of Net::Ping not ported yet" | ||||||||||||||||||||||||||
| 21 | 1 | ▶ | unless $method_map{$method}; | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||
| 23 | 1 | my @args; | |||||||||||||||||||||||||
| 24 | 1 | ▶ | if (ref $_[0]) { | ||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||
| 25 | 0 | @args = ($_[0]) | |||||||||||||||||||||||||
| 26 | } else { | ||||||||||||||||||||||||||
| 27 | 1 | my ($default_timeout, $bytes, $device, $tos, $ttl) = @_; | |||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||
| 29 | 1 | ▶ | @args = ( | ||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||
| 30 | (@_ >= 1 ? (default_timeout => $default_timeout) : ()), | ||||||||||||||||||||||||||
| 31 | (@_ >= 2 ? (bytes => $bytes) : ()), | ||||||||||||||||||||||||||
| 32 | (@_ >= 3 ? (device => $device) : ()), | ||||||||||||||||||||||||||
| 33 | (@_ >= 4 ? (tos => $tos) : ()), | ||||||||||||||||||||||||||
| 34 | (@_ >= 5 ? (ttl => $ttl) : ()), | ||||||||||||||||||||||||||
| 35 | ) | ||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||
| 37 | 1 | use_module('Net::Async::Ping::' . $method_map{$method})->new(@args) | |||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||
| 40 | 1 | 1; | |||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||