NAME
Linux::Info::DistributionFinder - class to search for candidate files
VERSION
version 2.17
SYNOPSIS
use Linux::Info::DistributionFinder;
my $finder = Linux::Info::DistributionFinder->new;
my $info_ref = $finder->search_distro;
DESCRIPTION
This class should be used to retrieve Linux distribution information on several candidates files.
First it tries /etc/os-release (since it should contain more data), then look into other known places.
METHODS
new
Creates and returns a new instance.
An optional parameter might be passed, which is how to handle caching.
If the parameter is "true" (1), result will be cached after a call to search_distro
method. If "false" (0), each call of search_distro
will invalidate the cache and files will be searched and parsed.
The default value is "false" (0) and is probably what you want unless you want to rely on the cache or using has_distro_info
and has_custom_dir
methods.
set_config_dir
Changes the default configuration directory used by a instance.
Most useful for unit testing with mocks.
search_distro
Searches for specific files to try to determine the distribution.
Returns a instance of Linux::Info::Distribution::BasicInfo.
has_distro_info
Returns "true" (1) if the instance has already cached distribution information.
Otherwise, returns "false" (0).
has_custom_dir
Returns "true" (1) if the instance is using a source directory different from /etc.
Otherwise, returns "false" (0).
has_custom_file
Returns "true" (1) if the instance is using a distribution customized file ( i.e. something diferent of /etc/os-release).
Otherwise, returns "false" (0).
has_os_release
Returns "true" (1) if the instance is using /etc/os-release or a os-release located in a customized source directory (see has_custom_dir
).
EXPORTS
Nothing.
You can use Linux::Info:DistributionFinder::DEFAULT_CONFIG_DIR
to fetch the default directory used to search for distribution information.
AUTHOR
Alceu Rodrigues de Freitas Junior <glasswalk3r@yahoo.com.br>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Alceu Rodrigues de Freitas Junior.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007