| 1 | #!/usr/local/bin/perl -w | ||||||||||||||||||||||||||||||||
| 2 | ###################################################################### | ||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||
| 4 | # DNS/Config/Server.pm | ||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||
| 6 | # $Id: Server.pm,v 1.3 2003/02/16 10:15:31 awolf Exp $ | ||||||||||||||||||||||||||||||||
| 7 | # $Revision: 1.3 $ | ||||||||||||||||||||||||||||||||
| 8 | # $Author: awolf $ | ||||||||||||||||||||||||||||||||
| 9 | # $Date: 2003/02/16 10:15:31 $ | ||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||
| 11 | # Copyright (C)2001-2003 Andy Wolf. All rights reserved. | ||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||
| 13 | # This library is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||
| 14 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||
| 16 | ###################################################################### | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | package DNS::Config::Server; | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | no warnings 'portable'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use 5.6.0; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | 2 | my $VERSION = '0.66'; | |||||||||||||||||||||||||||||||
| 26 | 2 | my $REVISION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 29 | 0 | my($pkg, $name, $managed) = @_; | |||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $class = ref($pkg) || $pkg; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $pkg || $pkg
MC/DC0%0/2
ref $pkg || $pkg
ref $pkg
$pkg
Truth table0%0/3
A || B
A= ref $pkgB= $pkg
| |||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 0 | my $self = { | |||||||||||||||||||||||||||||||
| 34 | 'id' => undef, | ||||||||||||||||||||||||||||||||
| 35 | 'name' => $name, | ||||||||||||||||||||||||||||||||
| 36 | 'managed' => $managed, | ||||||||||||||||||||||||||||||||
| 37 | 'zones' => [], | ||||||||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 0 | return $self; | |||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub id { | ||||||||||||||||||||||||||||||
|
Subroutine
id: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 46 | 0 | my($self, $id) = @_; | |||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $self->{'id'} = $id if($id); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 0 | return $self->{'id'}; | |||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub name { | ||||||||||||||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 54 | 0 | my($self, $name) = @_; | |||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | $self->{'name'} = $name if($name); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | 0 | return $self->{'name'}; | |||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub managed { | ||||||||||||||||||||||||||||||
|
Subroutine
managed: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 62 | 0 | my($self, $managed) = @_; | |||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | $self->{'managed'} = $managed if($managed); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 0 | return $self->{'managed'}; | |||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub add { | ||||||||||||||||||||||||||||||
|
Subroutine
add: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 70 | 0 | my($self, $zone) = @_; | |||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | push @{ $self->{'zones'} }, ($zone); | |||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | 0 | return $zone; | |||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | # sub delete { | ||||||||||||||||||||||||||||||||
| 78 | # } | ||||||||||||||||||||||||||||||||
| 79 | ######################################## | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub zone { | ||||||||||||||||||||||||||||||
|
Subroutine
zone: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 82 | 0 | my($self, %hash) = @_; | |||||||||||||||||||||||||||||||
| 83 | 0 | my $zone; | |||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | 0 | my @zones = $self->zones(); | |||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if(exists $hash{'NAME'} && $hash{'NAME'}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
exists $hash{"NAME"} and $hash{"NAME"}
MC/DC0%0/2
exists $hash{"NAME"} and $hash{"NAME"}
exists $hash{"NAME"}
$hash{"NAME"}
Truth table0%0/3
A and B
A= exists $hash{"NAME"}B= $hash{"NAME"}
| |||||||||||||||||||||||||||||||||
| 88 | 0 | for (@zones) { | |||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $zone = $_ if($_->name() eq $hash{'NAME'}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||
| 92 | ▶ | elsif(exists $hash{'ID'} && $hash{'ID'}) { | |||||||||||||||||||||||||||||||
|
Condition0%0/3
exists $hash{"ID"} and $hash{"ID"}
MC/DC0%0/2
exists $hash{"ID"} and $hash{"ID"}
exists $hash{"ID"}
$hash{"ID"}
Truth table0%0/3
A and B
A= exists $hash{"ID"}B= $hash{"ID"}
| |||||||||||||||||||||||||||||||||
| 93 | 0 | for (@zones) { | |||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $zone = $_ if($_->id() eq $hash{'ID'}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | 0 | return $zone; | |||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub zones { | ||||||||||||||||||||||||||||||
|
Subroutine
zones: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 102 | 0 | my($self, @zones) = @_; | |||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $self->{'zones'} = \@zones if(scalar @zones); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my $result = $self->{'zones'} if(ref($self->{'zones'}) eq 'ARRAY'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | 0 | return @$result; | |||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub debug { | ||||||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=1 SCAR=1.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 112 | 0 | my($self) = @_; | |||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | 0 | eval { | |||||||||||||||||||||||||||||||
| 115 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||
| 117 | 0 | print Dumper($self); | |||||||||||||||||||||||||||||||
| 118 | }; | ||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | 0 | return; | |||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | 2 | 1; | |||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||
| 125 | __END__ | ||||||||||||||||||||||||||||||||