documentation and attribution fixes
[scpubgit/System-Introspector.git] / lib / System / Introspector / Probe / Hosts.pm
1 package System::Introspector::Probe::Hosts;
2 use Moo;
3
4 use System::Introspector::Util qw(
5     output_from_file
6     transform_exceptions
7 );
8
9 has hosts_file => (
10     is      => 'ro',
11     default => sub { '/etc/hosts' },
12 );
13
14 sub gather {
15     my ($self) = @_;
16     my $file = $self->hosts_file;
17     return {
18         hosts_file => transform_exceptions {
19             return {
20                 file_name => $file,
21                 body => scalar output_from_file $file,
22             };
23         },
24     };
25 }
26
27 1;
28
29 __END__
30
31 =head1 NAME
32
33 System::Introspector::Probe::Hosts - Gather known hosts
34
35 =head1 DESCRIPTION
36
37 Reads a C<hosts> file to produce a list of known hosts
38
39 =head1 ATTRIBUTES
40
41 =head2 hosts_file
42
43 The path to the C<hosts> file that should be read. Defaults to C</etc/hosts>.
44
45 =head1 SEE ALSO
46
47 =over
48
49 =item L<System::Introspector>
50
51 =back
52
53 =head1 COPYRIGHT
54
55 Copyright (c) 2012 the L<System::Introspector>
56 L<AUTHOR|System::Introspector/AUTHOR>,
57 L<CONTRIBUTORS|System::Introspector/CONTRIBUTORS> and
58 L<SPONSORS|System::Introspector/SPONSORS>.
59
60 =head1 LICENSE
61
62 This library is free software and may be distributed under the same terms
63 as perl itself.
64
65 =cut