1 package System::Introspector::Hosts;
6 default => sub { '/etc/hosts' },
11 my $fh = $self->_open_hosts_file;
13 while (defined( my $line = <$fh> )) {
15 next if $line =~ m{^\s*$}
17 push @hosts, [split m{\s+}, $line];
22 sub _open_hosts_file {
24 my $file = $self->hosts_file;
25 open my $fh, '<', $file
26 or die "Unable to read $file: $!\n";
36 System::Introspector::Hosts - Gather known hosts
40 Reads a C<hosts> file to produce a list of known hosts
46 The path to the C<hosts> file that should be read. Defaults to C</etc/hosts>.
52 =item L<System::Introspector>