Jan Henning Thorsen
and 1 contributors

NAME

DOCSIS::ConfigFile - Decodes and encodes DOCSIS config-files

VERSION

0.5901

SYNOPSIS

    use DOCSIS::ConfigFile;
    use YAML;

    my $obj     = DOCSIS::ConfigFile->new(
                      shared_secret   => '', # default
                      advanced_output => 0,  # default
                  );

                  $obj->shared_secret("foobar");
    my $encoded = $obj->encode([ {...}, {...}, ... ]);
    my $decoded = $obj->decode($filename);
                  $obj->advanced_output(1);
    my $dec_adv = $obj->decode(\$encoded);

    print YAML::Dump($decoded); # see simple config in YAML format
    print YAML::Dump($dec_adv); # see advanced config in YAML format

METHODS

new(%args)

Object constructor.

Arguments can be:

 shared_secret   => Shared secret in encoded cm config file
 advanced_output => Advanced decoded config format
 mibs            => will set $ENV{MIBS} to load custom mibs
 log             => Custom logger

decode

Decodes a binary config-file. Needs only one of these arguments: Filehandle, path to file or reference to a binary string.

Returns an array-ref of hashes, containing the config as a perl data structure.

encode

Encodes an array of hashes, containing the DOCSIS config-file settings. Takes only on argument: An array-ref of hashes.

Returns a binary string.

shared_secret

Sets or gets the shared secret.

advanced_output

Sets weither advanced output should be enabled. Takes 0 or 1 as argument. Advanced output is off (0) by default.

errors

Retrieves the errors if encode() or decode() fails.

logger

CONSTANTS

Decode

Returns DOCSIS::ConfigFile::Decode.

Encode

Returns DOCSIS::ConfigFile::Encode.

Syminfo

Returns DOCSIS::ConfigFile::Syminfo.

AUTHOR

Jan Henning Thorsen, <pm at flodhest.net>

BUGS

Please report any bugs or feature requests to bug-docsis-perl at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DOCSIS-ConfigFile. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc DOCSIS::ConfigFile

You can also look for information at http://search.cpan.org/dist/DOCSIS-ConfigFile

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Copyright (c) 2007 Jan Henning Thorsen

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, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

DOCSIS is a registered trademark of Cablelabs, http://www.cablelabs.com

This module got its inspiration from the program docsis, http://docsis.sf.net.