From: Robert 'phaylon' Sedlacek Date: Tue, 8 May 2012 18:59:35 +0000 (+0000) Subject: made resolv.conf file path configurable X-Git-Tag: v0.001_001~116 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21fd4f467dbec2c70808ec526a344058ca40af27;p=scpubgit%2FSystem-Introspector.git made resolv.conf file path configurable --- diff --git a/lib/System/Introspector/ResolvConf.pm b/lib/System/Introspector/ResolvConf.pm index cf9513c..7def573 100644 --- a/lib/System/Introspector/ResolvConf.pm +++ b/lib/System/Introspector/ResolvConf.pm @@ -1,6 +1,11 @@ package System::Introspector::ResolvConf; use Moo; +has resolv_conf_file => ( + is => 'ro', + default => sub { '/etc/resolv.conf' }, +); + sub gather { my ($self) = @_; my $fh = $self->_open_resolv_conf_file; @@ -16,8 +21,9 @@ sub gather { sub _open_resolv_conf_file { my ($self) = @_; - open my $fh, '<', '/etc/resolv.conf' - or die "Unable to read /etc/resolv.conf: $!"; + my $file = $self->resolv_conf_file; + open my $fh, '<', $file + or die "Unable to read $file: $!"; return $fh; }