| 1 | package Zabbix::API::Host; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use 5.010; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 2 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 2 | ▶ | use parent qw/Zabbix::API::CRUDE/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 0 | ▶ | sub id { | ||||||||||
|
Subroutine
id: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 11 | |||||||||||||
| 12 | ## mutator for id | ||||||||||||
| 13 | |||||||||||||
| 14 | 0 | my ($self, $value) = @_; | |||||||||||
| 15 | |||||||||||||
| 16 | 0 | ▶ | if (defined $value) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | |||||||||||||
| 18 | 0 | $self->data->{hostid} = $value; | |||||||||||
| 19 | 0 | return $self->data->{hostid}; | |||||||||||
| 20 | |||||||||||||
| 21 | } else { | ||||||||||||
| 22 | |||||||||||||
| 23 | 0 | return $self->data->{hostid}; | |||||||||||
| 24 | |||||||||||||
| 25 | } | ||||||||||||
| 26 | |||||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | 0 | ▶ | sub prefix { | ||||||||||
|
Subroutine
prefix: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 30 | |||||||||||||
| 31 | 0 | my (undef, $suffix) = @_; | |||||||||||
| 32 | |||||||||||||
| 33 | 0 | ▶ | if ($suffix) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | |||||||||||||
| 35 | 0 | return 'host'.$suffix; | |||||||||||
| 36 | |||||||||||||
| 37 | } else { | ||||||||||||
| 38 | |||||||||||||
| 39 | 0 | return 'host'; | |||||||||||
| 40 | |||||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | 0 | ▶ | sub extension { | ||||||||||
|
Subroutine
extension: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 46 | |||||||||||||
| 47 | 0 | return ( output => 'extend', | |||||||||||
| 48 | select_macros => 'extend', | ||||||||||||
| 49 | select_groups => 'extend' ); | ||||||||||||
| 50 | |||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | 0 | ▶ | sub collides { | ||||||||||
|
Subroutine
collides: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 54 | |||||||||||||
| 55 | 0 | my $self = shift; | |||||||||||
| 56 | |||||||||||||
| 57 | 0 | return @{$self->{root}->query(method => $self->prefix('.get'), | |||||||||||
| 58 | params => { filter => { host => $self->data->{host} }, | ||||||||||||
| 59 | 0 | $self->extension })}; | |||||||||||
| 60 | |||||||||||||
| 61 | } | ||||||||||||
| 62 | |||||||||||||
| 63 | 0 | ▶ | sub name { | ||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 64 | |||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||
| 66 | |||||||||||||
| 67 | 0 | ▶ | return $self->data->{host} || ''; | ||||||||||
|
Condition0%0/2
$self->data->{'host'} || ''
MC/DC0%0/1
$self->data->{'host'} || ''
$self->data->{'host'}
Truth table0%0/2
A
A= $self->data->{'host'}
| |||||||||||||
| 68 | |||||||||||||
| 69 | } | ||||||||||||
| 70 | |||||||||||||
| 71 | 0 | ▶ | sub items { | ||||||||||
|
Subroutine
items: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 72 | |||||||||||||
| 73 | ## accessor for items | ||||||||||||
| 74 | |||||||||||||
| 75 | 0 | my ($self, $value) = @_; | |||||||||||
| 76 | |||||||||||||
| 77 | 0 | ▶ | if (defined $value) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 78 | |||||||||||||
| 79 | 0 | die 'Accessor items called as mutator'; | |||||||||||
| 80 | |||||||||||||
| 81 | } else { | ||||||||||||
| 82 | |||||||||||||
| 83 | 0 | my $items = $self->{root}->fetch('Item', params => { hostids => [ $self->data->{hostid} ] }); | |||||||||||
| 84 | |||||||||||||
| 85 | 0 | $self->{items} = $items; | |||||||||||
| 86 | |||||||||||||
| 87 | 0 | return $self->{items}; | |||||||||||
| 88 | |||||||||||||
| 89 | } | ||||||||||||
| 90 | |||||||||||||
| 91 | } | ||||||||||||
| 92 | |||||||||||||
| 93 | 2 | 1; | |||||||||||
| 94 | __END__ | ||||||||||||