16b7a26d3904cfbdbe3f7631f90b2b48fb17a4a5
[scpubgit/System-Introspector.git] / lib / System / Introspector / Probe / ResolvConf.pm
1 package System::Introspector::Probe::ResolvConf;
2 use Moo;
3
4 use System::Introspector::Util qw(
5     output_from_file
6     transform_exceptions
7 );
8
9 has resolv_conf_file => (
10     is      => 'ro',
11     default => sub { '/etc/resolv.conf' },
12 );
13
14 sub gather {
15     my ($self) = @_;
16     return {
17         resolv_conf_file => transform_exceptions {
18             my $file = $self->resolv_conf_file;
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::ResolvConf - Gather name resolution configuration
34
35 =head1 DESCRIPTION
36
37 Reads a C<resolv.conf> file to gather information about name resolution.
38
39 =head1 ATTRIBUTES
40
41 =head2 resolv_conf_file
42
43 The path to the C<resolv.conf> file that should be read. Defaults to
44 C</etc/resolv.conf>.
45
46 =head1 SEE ALSO
47
48 =over
49
50 =item L<System::Introspector>
51
52 =back
53
54 =head1 COPYRIGHT
55
56 Copyright (c) 2012 the L<System::Introspector>
57 L<AUTHOR|System::Introspector/AUTHOR>,
58 L<CONTRIBUTORS|System::Introspector/CONTRIBUTORS> and
59 L<SPONSORS|System::Introspector/SPONSORS>.
60
61 =head1 LICENSE
62
63 This library is free software and may be distributed under the same terms
64 as perl itself.
65
66 =cut