NAME
Footprintless::Localhost - A localhost alias resolver
VERSION
version 1.29
DESCRIPTION
Provides a fairly thorough attempt to determine if a supplied hostname is an alias for localhost (resolves to the same physical machine). This can be useful in determining if local commands can be used in place of remote commands. This is primarily used by the Footprintless::CommandOptionsFactory to create appropriate command options for configured entities.
CONSTRUCTORS
new(%options)
Constructs a new Footprintless::Localhost
preconfigured with the default aliases (localhost
, 127.0.0.1
). The available options are:
- aliases
-
An initial set of preconfigured aliases that should resolve to localhost.
- empty
-
Sets the value that will be returned if
is_alias
is called with a falsey value. - etc_hosts_file
-
Location of hosts file, defaults to
/etc/hosts
. - none
-
Stops the constructor from initializing the default aliases:
localhost
,127.0.0.1
.
METHODS
is_alias($hostname)
Returns a truthy value if $hostname
is an alias for localhost.
is_loaded($source)
Returns a truthy value if $source
has already been loaded. Each source is loaded using the load_$source
method.
load_127_subnet()
Same effect as loading all 127.x.x.x
addresses, but done with regex during call to is_alias.
load_all()
Loads aliases from all sources.
load_etc_hosts()
Loads aliases from the /etc/hosts
file.
load_hostfqdn()
Loads aliases from the hostfqdn
command.
load_hostname()
Loads aliases from the hostname
command.
AUTHOR
Lucas Theisen <lucastheisen@pastdev.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
SEE ALSO
Please see those modules/websites for more information related to this module.