The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Linux::Info::DistributionFactory - implements a factory for Distribution subclasses

VERSION

version 2.11

SYNOPSIS

    use Linux::Info::DistributionFactory;
    use Linux::Info::DistributionFinder;

    my $instance = Linux::Info::DistributionFactory->new(
        Linux::Info::DistributionFinder->new
    );
    print $instance->distro_name, "\n";

DESCRIPTION

This class implements the design patter of Factory to handle how to create all existing variations of subclass of Linux::Info::Distribution subclasses.

METHODS

new

Creates and return a new instance.

Expects a instance of Linux::Info::DistributionFinder as a parameter.

distro_name

Returns the current Linux distribution name from where the Factory was created.

create

Creates and return a instance of Linux::Info::Distribution subclasses, based on the several criterias to define the source and format of the data.

Instances will be returned based on subclasses of Linux::Info::Distribution::OSRelease or Linux::Info::Distribution::Custom.

The first attempt is to use the file /etc/os-release to fetch information. In this case, if a subclass of Linux::INfo::Distribution::OSRelease is not available, this class will be used instead, which means less attributes will be available.

If the file is not available, others will be attempted.

EXPORTS

Nothing.

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