Commit | Line | Data |
afd7c030 |
1 | package System::Introspector::Probe::Hosts; |
645a8f49 |
2 | use Moo; |
3 | |
a042903a |
4 | use System::Introspector::Util qw( |
5a9311b3 |
5 | output_from_file |
a042903a |
6 | transform_exceptions |
7 | ); |
8 | |
8d888cc1 |
9 | has hosts_file => ( |
10 | is => 'ro', |
11 | default => sub { '/etc/hosts' }, |
12 | ); |
13 | |
645a8f49 |
14 | sub gather { |
15 | my ($self) = @_; |
5a9311b3 |
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 | }, |
a042903a |
24 | }; |
645a8f49 |
25 | } |
26 | |
645a8f49 |
27 | 1; |
535e84b6 |
28 | |
29 | __END__ |
30 | |
31 | =head1 NAME |
32 | |
f24afb0e |
33 | System::Introspector::Probe::Hosts - Gather known hosts |
535e84b6 |
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 | |
f24afb0e |
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 |
535e84b6 |
61 | |
f24afb0e |
62 | This library is free software and may be distributed under the same terms |
63 | as perl itself. |
64 | |
65 | =cut |