determine unique perls by their sitelibexp config setting
[scpubgit/System-Introspector.git] / lib / System / Introspector / Probe / Hosts.pm
index d1a0d8b..bc2ab76 100644 (file)
@@ -2,7 +2,7 @@ package System::Introspector::Probe::Hosts;
 use Moo;
 
 use System::Introspector::Util qw(
-    handle_from_file
+    output_from_file
     transform_exceptions
 );
 
@@ -13,24 +13,17 @@ has hosts_file => (
 
 sub gather {
     my ($self) = @_;
-    return transform_exceptions {
-        my $fh = $self->_open_hosts_file;
-        my @hosts;
-        while (defined( my $line = <$fh> )) {
-            chomp $line;
-            next if $line =~ m{^\s*$}
-                 or $line =~ m{^\s*#};
-            push @hosts, [split m{\s+}, $line];
-        }
-        return { hosts => \@hosts };
+    my $file = $self->hosts_file;
+    return {
+        hosts_file => transform_exceptions {
+            return {
+                file_name => $file,
+                body => scalar output_from_file $file,
+            };
+        },
     };
 }
 
-sub _open_hosts_file {
-    my ($self) = @_;
-    return handle_from_file $self->hosts_file;
-}
-
 1;
 
 __END__