simplified ResolvConf probe output and make it conform to standard file data structure
[scpubgit/System-Introspector.git] / lib / System / Introspector / Probe / ResolvConf.pm
index 3417496..753085f 100644 (file)
@@ -2,7 +2,7 @@ package System::Introspector::Probe::ResolvConf;
 use Moo;
 
 use System::Introspector::Util qw(
-    handle_from_file
+    output_from_file
     transform_exceptions
 );
 
@@ -13,24 +13,17 @@ has resolv_conf_file => (
 
 sub gather {
     my ($self) = @_;
-    return transform_exceptions {
-        my $fh = $self->_open_resolv_conf_file;
-        my @resolv;
-        while (defined( my $line = <$fh> )) {
-            chomp $line;
-            next if $line =~ m{^\s*$}
-                 or $line =~ m{^\s*#};
-            push @resolv, [split m{\s+}, $line];
-        }
-        return { resolv_conf => \@resolv };
+    return {
+        resolv_conf_file => transform_exceptions {
+            my $file = $self->resolv_conf_file;
+            return {
+                file_name => $file,
+                body => scalar output_from_file $file,
+            };
+        },
     };
 }
 
-sub _open_resolv_conf_file {
-    my ($self) = @_;
-    return handle_from_file $self->resolv_conf_file;
-}
-
 1;
 
 __END__