.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Hostfile::Manager 3pm" .TH Hostfile::Manager 3pm "2021-01-07" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Hostfile::Manager \- Manage a hostfile by composing multiple fragments into a whole. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Hostfile::Manager; \& \& $manager = Hostfile::Manager\->new; \& $manager\->enable_fragment($fragment_name); \& $manager\->write_hostfile; .Ve .SH "ACCESSORS" .IX Header "ACCESSORS" .IP "\fBStr path_prefix( [Str \f(CB$prefix\fB] )\fR" 6 .IX Item "Str path_prefix( [Str $prefix] )" Defines the prefix that will be searched for hostfile fragments. Defaults to '/etc/hostfiles/'. .IP "\fBStr hostfile_path( [Str \f(CB$path\fB] )\fR" 6 .IX Item "Str hostfile_path( [Str $path] )" Defines the path to the hostfile to manage. Defaults to '/etc/hosts'. .IP "\fBStr hostfile\fR" 6 .IX Item "Str hostfile" The contents of the hostfile under management. .IP "\fBHashRef fragments\fR" 6 .IX Item "HashRef fragments" The available hostfile fragments. .IP "\fBArray fragment_list\fR" 6 .IX Item "Array fragment_list" A list of the names of available fragments. .IP "\fBStr get_fragment( Str \f(CB$fragment_name\fB )\fR" 6 .IX Item "Str get_fragment( Str $fragment_name )" The contents of an individual hostfile fragment. .SH "METHODS" .IX Header "METHODS" .IP "\fBHostfile::Manager\->new( [\e%options] )\fR" 6 .IX Item "Hostfile::Manager->new( [%options] )" Create a new manager instance. Available options are \fBpath_prefix\fR and \fBhostfile_path\fR, listed in the \s-1ACCESSORS\s0 section. .IP "\fBBool write_hostfile\fR" 6 .IX Item "Bool write_hostfile" Write the contents of the hostfile to disk. .IP "\fBBool fragment_enabled( Str \f(CB$fragment_name\fB )\fR" 6 .IX Item "Bool fragment_enabled( Str $fragment_name )" Test whether a named fragment is enabled in the hostfile under management. .IP "\fBenable_fragment( Str \f(CB$fragment_name\fB )\fR" 6 .IX Item "enable_fragment( Str $fragment_name )" Enable a named fragment. If the fragment is currently enabled, it will be disabled first, removing any modifications that may have been made out-of-band. .IP "\fBdisable_fragment( Str \f(CB$fragment_name\fB )\fR" 6 .IX Item "disable_fragment( Str $fragment_name )" Disable a named fragment. .IP "\fBtoggle_fragment( Str \f(CB$fragment_name\fB )\fR" 6 .IX Item "toggle_fragment( Str $fragment_name )" Enable a fragment if it is disabled, disable it otherwise. .IP "\fBStr fragment_status_flag( Str \f(CB$fragment_name\fB )\fR" 6 .IX Item "Str fragment_status_flag( Str $fragment_name )" Returns a string indicating the current status of a named fragment. .RS 6 .ie n .IP "\fB""+""\fR" 2 .el .IP "\fB``+''\fR" 2 .IX Item "+" The named fragment is enabled. .ie n .IP "\fB""*""\fR" 2 .el .IP "\fB``*''\fR" 2 .IX Item "*" The named fragment is enabled and has been modified in the sourced hostfile. .ie n .IP "\fB"" ""\fR" 2 .el .IP "\fB`` ''\fR" 2 .IX Item " " The named fragment is not enabled. .RE .RS 6 .RE .SH "LICENSE" .IX Header "LICENSE" Copyright (c) 2010\-11,2018 Anthony J. Mirabella. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "AUTHOR" .IX Header "AUTHOR" Anthony J. Mirabella