DESCRIPTION

RoPkg::Rsync::ConfFile is a class used to manipulate rsync configuration files. Is capable to maintaine the order of the modules, and even keep your comments and empty lines intact.

SYNOPSIS

 #!/usr/bin/perl

use warnings; use strict;

sub main { my $cf = new RoPkg::Rsync::ConfFile(filename => '/etc/rsyncd.conf');

$cf->Write('/tmp/new_rsyncd.conf'); return 0; }

main();

METHODS

All methods, throw the OutsideClass exception, if you use them as class methods. Besides OutsideClass the methods are throwing other exceptions as well. Refer to each method documentation for more information.

\$1

The class constructor. Accepts a hash as parameter. At this moment only one parameter can be specified inside the hash: filename . If this parameter is present, the file specified is parsed and loaded into the object. Add a new global parameter named $pname with value $value. Add a new global comment with value $pval Add a new global blank line with value $bval Adds a new RoPkg::Rsync::Node object to the current object. Before the node is added, the nodes list is checked for duplicates of the object. If a duplicate is found, the method does nothing.

Exceptions:

If $node is not a instance of RoPkg::Rsync::Node, Param::Wrong exception is raised. Removes a node from the nodes list. The nodes are searched by their names. Returns -1 if the node was not found, the new number of nodes otherwise. Returns 1 if the node with name $node_name was found in the nodes list, 0 otherwise. Clean the object. Removes all information (the nodes list, statistics, etc). Always returns 1. Parse the configuration file $filename and returns the number of nodes. If $filename is not defined Param::Missing exception is raised. If the path does not point to a existing file, File::NotFound exception is raised. If the file could not be opened, File::Open exception is raised. Write the configuration into the file specified by path $path. Returns the string representation of the configuration file.

PREREQUISITES

perl 5.008 (or later) is required. Besides perl, you must have the following:

*) RoPkg::Exceptions
*) Scalar::Util
*) English

RELATED TO RoPkg::Rsync::ConfFile…

RoPkg::Rsync::Atom RoPkg::Rsync::ConfFile RoPkg::Exceptions

AUTHOR

Subredu Manuel <[email protected]>

LICENSE

Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The \s-1LICENSE\s0 file contains the full text of the license.