| 1 | package Net::Peep::Client::Pinger::Host; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | require 5.00503; | |||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | # use warnings; # commented out for 5.005 compatibility | ||||||||||||||||||||
| 6 | 2 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 2 | ▶ | use Net::Peep::Host; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 2 | ▶ | use Net::Peep::Host::Pool; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | require Exporter; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 2 | ▶ | use vars qw{ @ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION }; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 2 | @ISA = qw(Exporter Net::Peep::Host); | |||||||||||||||||||
| 16 | 2 | %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); | |||||||||||||||||||
| 17 | 2 | @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||
| 18 | 2 | @EXPORT = qw( ); | |||||||||||||||||||
| 19 | 2 | $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||
| 24 | 0 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 25 | 0 | my $this = $class->SUPER::new(); | |||||||||||||||||||
| 26 | 0 | bless $this, $class; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | } # end sub new | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | ▶ | sub name { | ||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 0 | my $self = shift; | |||||||||||||||||||
| 33 | 0 | ▶ | if (@_) { $self->{'NAME'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 34 | 0 | return $self->{'NAME'}; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | } # end sub name | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | sub host { | ||||||||||||||||||
|
Subroutine
host: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | my $self = shift; | |||||||||||||||||||
| 41 | 0 | ▶ | unless (exists $self->{'HOST'}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | 0 | ▶ | my $name = $self->name() || confess "Cannot get host object: No host name or IP address found."; | ||||||||||||||||||
|
Condition0%0/2
$self->name || confess('Cannot get host object: No host name or IP address found.')
MC/DC0%0/1
$self->name || confess('Cannot get host object: No host name or IP address found.')
$self->name
Truth table0%0/2
A
A= $self->name
| |||||||||||||||||||||
| 43 | 0 | my $host = new Net::Peep::Host; | |||||||||||||||||||
| 44 | 0 | ▶ | if ($host->isIP($name)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | 0 | $host->ip($name); | |||||||||||||||||||
| 46 | } else { | ||||||||||||||||||||
| 47 | 0 | $host->name($name); | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | 0 | $self->{'HOST'} = $host; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | 0 | return $self->{'HOST'}; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | } # end sub host | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 0 | ▶ | sub event { | ||||||||||||||||||
|
Subroutine
event: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 0 | my $self = shift; | |||||||||||||||||||
| 58 | 0 | ▶ | if (@_) { $self->{'EVENT'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 59 | 0 | return $self->{'EVENT'}; | |||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | } # end sub event | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 0 | ▶ | sub group { | ||||||||||||||||||
|
Subroutine
group: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||||||||||
| 66 | 0 | ▶ | if (@_) { $self->{'GROUP'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 67 | 0 | return $self->{'GROUP'}; | |||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | } # end sub group | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 0 | ▶ | sub location { | ||||||||||||||||||
|
Subroutine
location: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||||||||||
| 74 | 0 | ▶ | if (@_) { $self->{'LOCATION'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 75 | 0 | return $self->{'LOCATION'}; | |||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | } # end sub location | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 0 | ▶ | sub priority { | ||||||||||||||||||
|
Subroutine
priority: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 0 | my $self = shift; | |||||||||||||||||||
| 82 | 0 | ▶ | if (@_) { $self->{'PRIORITY'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 83 | 0 | return $self->{'PRIORITY'}; | |||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | } # end sub priority | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 0 | ▶ | sub notification { | ||||||||||||||||||
|
Subroutine
notification: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | 0 | my $self = shift; | |||||||||||||||||||
| 90 | 0 | ▶ | if (@_) { $self->{'NOTIFICATION'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 91 | 0 | return $self->{'NOTIFICATION'}; | |||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | } # end sub notification | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 0 | ▶ | sub hosts { | ||||||||||||||||||
|
Subroutine
hosts: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | 0 | my $self = shift; | |||||||||||||||||||
| 98 | 0 | ▶ | if (@_) { $self->{'HOSTS'} = shift; } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 99 | 0 | return $self->{'HOSTS'}; | |||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | } # end sub hosts | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | 0 | ▶ | sub pool { | ||||||||||||||||||
|
Subroutine
pool: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 0 | my $self = shift; | |||||||||||||||||||
| 106 | 0 | ▶ | unless (exists $self->{'POOL'}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 107 | 0 | ▶ | my $hosts = $self->hosts() | ||||||||||||||||||
|
Condition0%0/2
$self->hosts || confess('Cannot get host pool: No hosts have been identified yet.')
MC/DC0%0/1
$self->hosts || confess('Cannot get host pool: No hosts have been identified yet.')
$self->hosts
Truth table0%0/2
A
A= $self->hosts
| |||||||||||||||||||||
| 108 | || confess "Cannot get host pool: No hosts have been identified yet."; | ||||||||||||||||||||
| 109 | 0 | my $pool = new Net::Peep::Host::Pool; | |||||||||||||||||||
| 110 | 0 | $pool->addHosts($hosts); | |||||||||||||||||||
| 111 | 0 | $self->{'POOL'} = $pool; | |||||||||||||||||||
| 112 | } | ||||||||||||||||||||
| 113 | 0 | return $self->{'POOL'}; | |||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | } # end sub pool | ||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 2 | 1; | |||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | __END__ | ||||||||||||||||||||