File Coverage

blib/lib/Eixo/Zone/Artifact/NetworkNS.pm
Criterion Covered Total %
statement 11 16 68.7
branch 1 6 16.6
condition n/a
subroutine 5 8 62.5
pod 0 5 0.0
total 17 35 48.5


line stmt bran cond sub pod time code
1             package Eixo::Zone::Artifact::NetworkNS;
2              
3 2     2   7342 use strict;
  2         12  
  2         126  
4 2     2   16 use parent qw(Eixo::Zone::Artifact);
  2         8  
  2         23  
5              
6             sub new{
7              
8 2     2 0 577 my ($self) = bless({
9              
10             name=>$_[1],
11              
12             ctl => $_[2],
13              
14             f_created=>undef,
15              
16             }, $_[0]);
17              
18 2         12 $self;
19              
20             }
21              
22             sub DESTROY{
23              
24 2 50   2   61 $_[0]->delete if($_[0]->{f_created});
25             }
26              
27             sub integrity{
28              
29             ($_[0]->{f_created}) ?
30            
31             $_[0]->{ctl}->ns_exists($_[0]->{name}) :
32              
33             !$_[0]->{ctl}->ns_exists($_[0]->{name})
34              
35 0 0   0 0 0 }
36              
37             sub clean{
38 0     0 0 0 $_[0]->delete;
39             }
40              
41             sub create{
42 2     2 0 13 my ($self) = @_;
43              
44 2         78 $self->{ctl}->ns_create($self->{name});
45              
46 0           $self->{f_created} = 1;
47             }
48              
49             sub delete{
50 0     0 0   my ($self) = @_;
51              
52             $self->{ctl}->ns_delete($self->{name}) if(
53              
54             $self->{ctl}->ns_exists($_[0]->{name})
55              
56 0 0         );
57             }
58              
59             1;