diff options
| -rw-r--r-- | AdminPanel/Hosts/hosts.pm | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/AdminPanel/Hosts/hosts.pm b/AdminPanel/Hosts/hosts.pm index 97f9a90e..6b2264f9 100644 --- a/AdminPanel/Hosts/hosts.pm +++ b/AdminPanel/Hosts/hosts.pm @@ -13,9 +13,15 @@ my $is_none = 0;  has 'configHosts' => (  	is => 'rw', -	init_arg => undef +	init_arg => undef, +	builder => '_initialize'  ); +sub _initialize { +	my $self = shift(); +	$self->configHosts(Config::Hosts->new()); +} +  =pod  =head2 _getHosts @@ -34,7 +40,7 @@ retrieve data from the hosts file (/etc/hosts) using the Config::Hosts module  sub _getHosts {  	my $self = shift(); -	$self->configHosts(Config::Hosts->new()); +	# $self->configHosts(Config::Hosts->new());  	my $hosts = $self->configHosts->read_hosts();  	my @result = ();  	while( my ($key, $value) = each($hosts)){ @@ -57,6 +63,12 @@ sub _insertHost {  	return $self->configHosts->insert_host(ip => $ip, hosts => @host_definitions);  } +sub _dropHost { +	my $self = shift(); +	my $host_ip = shift(); +	return $self->configHosts->delete_host($host_ip); +} +  sub _writeHosts {  	my $self = shift();  	return $self->configHosts->write_hosts(); | 
