NAME

Rsync::Config::Module

VERSION

0.1

DESCRIPTION

A module is a module entry from a rsync configuration file. Ex: [cpan] path = /var/ftp/pub/mirrors/ftp.cpan.org/ comment = CPAN mirror

Rsync::Config::Module is used to create a module who can be later used in generating a rsync configuration file. Each module is made by atoms (Rsync::Config::Atom).

SYNOPSIS

use Rsync::Config::Module;

sub main {
  my $mod_cpan;

  $mod_cpan = new Rsync::Config::Module(name => 'cpan');

  $mod_cpan->add_atom(name => 'path', value => '/var/ftp/pub/mirrors/ftp.cpan.org/');
  $mod_cpan->add_atom(name => 'comment', value => 'CPAN mirror');
}

SUBROUTINES/METHODS

All subroutines and/or methods throw REX::OutsideClass when called outside class instance. Besides this, each method may throw other exceptions. Please see the documentation of each method for more information.

new(%opt)

The class contructor. %opt must contain at least a key named name with the name of the module. At this moment it is possible to specify two parameters:

*) indent - default 1
*) indent_char - default TAB

If indent is > 0 the text is indented indent times.

add_blank()

Adds a blank atom to this module.

add_comment($comment)

Adds a comment atom to this module.

add_atom($name, $value)

Adds a new atom to this module. The $name and $value are passed as they are to Rsync::Config::Atom

atoms_no()

Returns the number of current atoms.

atoms()

In scalar context returns a array reference to the list of current atoms. In array content returns a array of current atoms.

to_string()

Returns the string representation of the current module. If indent is true, a best of effort is made to indent the module.

DEPENDENCIES

Rsync::Config::Module uses the following modules:

English
Scalar::Util

DIAGNOSTICS

All tests are located in the t directory .

PERL CRITIC

This module is perl critic level 1 compliant.

CONFIGURATION AND ENVIRONMENT

This module does not use any configuration files or environment variables. The used modules however may use such things. Please refer to each module man page for more information.

INCOMPATIBILITIES

None known to the author

BUGS AND LIMITATIONS

Using atoms with values 0 or undef will trigger exceptions.

SEE ALSO

Rsync::Config::Exceptions Rsync::Config::Atom Rsync::Config

AUTHOR

Subredu Manuel <diablo@packages.ro>

LICENSE AND COPYRIGHT

Copyright (C) 2006 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 LICENSE file contains the full text of the license.