Subject: | FW: UPDATE: inquiry on Config::Hosts |
Date: | Mon, 16 Jun 2014 20:58:41 +0000 |
To: | <bug-Config-Hosts [...] rt.cpan.org> |
From: | <Ty_Young [...] Dell.com> |
Dell - Internal Use - Confidential
What would it take to enable Config::Hosts to add/modify/delete a comment for an entry in /etc/hosts ? More of a feature request than anything else, I guess ...
From: Young, Ty
Sent: Monday, June 16, 2014 8:52 AM
To: 'roman@parparov.com'
Subject: inquiry on Config::Hosts
Dell - Internal Use - Confidential
Hey Roman, thank you for providing the Config::Hosts CPAN module.
I have a question about its usage, and I will confess that I'm not the world's most experienced Perl scripter.
So I want to read in a local /etc/hosts file. My belief, from your documentation (perldoc Config::Hosts) is that I need to create a new object:
my $hosts = Config::Hosts->new();
... and then, to read the contents of /etc/hosts into a hash ...
%lines = $hosts->read_hosts();
... and then just cycle through each entry, evaluating it to see if it contains a valid IP:
$valid = $hosts->determine_ip_or_host ($key);
... and test to see if $valid is a 1 or a -1.
Is that basically it ?
-ty
Ty Young
Sr Data Protection Engineer
Data Management Team for Wolters Kluwer, USA
972-577-7957 (o) | 469-301-5821 (m)
[dell_logo]
Dell | Dedicated Infrastructure Services Delivery