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;
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;
}