The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Fritz::ConfigFile - configuration file handler for Net::Fritz::Box

VERSION

version v0.0.9

SYNOPSIS

    my $config = Net::Fritz::ConfigFile->new( 'some/dir/fritzrc' );
    my $config_hashref = $config->configuration;

DESCRIPTION

This class encapsulates the configuration file handling for Net::Fritz::Box. It should not be needed to directly interact with this class. No user-serviceable parts inside!

This class is available since v0.0.9.

CONFIGURATION FILE FORMAT

The configuration format is basically a flat text file with key = value per line. Empty lines as well as comments (prefixed by #) are supported.

These keys are recognized:

(AppConfig is used to read the configuration file, so some advanced tricks might be possible.)

DEFAULT CONFIGURATION FILE LOCATIONS

If the given configuration filename expands to false, these default configuration file locations are tried instead (in order):

1. $XDG_CONFIG_HOME/fritzrc (only if $XDG_CONFIG_HOME is set)
2. ~/.config/fritzrc
3. ~/.fritzrc

The first existing file will be used.

ATTRIBUTES (read-only)

configfile

Default value: none

Sets a configuration file to read the configuration from.

A ~ at the beginning of the filename will be expanded to $ENV{HOME}.

If the filename expands to false (0, '' or the like), the default configuration file locations will be tried. If none of those files exists, an empty configuration file is substituted.

configuration

Default value: none

The configuration values from the configuration file as a hashref.

Keys that were not present in the configuration file are not returned.

METHODS

new

Creates a new Net::Fritz::ConfigFile object. Expects parameters in key => value form with the following keys to overwrite the default values:

With only one parameter (in fact: any odd value of parameters), the first parameter is automatically mapped to "configfile".

SEE ALSO

See Net::Fritz for general information about this package, especially "INTERFACE" in Net::Fritz for links to the other classes.

AUTHOR

Christian Garbs <mitch@cgarbs.de>

COPYRIGHT AND LICENSE

Copyright (C) 2017 Christian Garbs

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.