NAME

Rsync::Config::Atom - atom of a rsync configuration file

VERSION

0.2

DESCRIPTION

Rsync::Config::Atom is the smallest element of a rsync configuration file. Every atom has a name and a value. There are 2 types of atoms with special treatment.

blank atoms (empty lines)
comment atoms

Rsync::Config::Atom inherits from Rsync::Config::Renderer.

SYNOPSIS

 use Rsync::Config::Atom;

 sub main {
   my $atom = new Rsync::Config::Atom(name => 'path', value => '/var/ftp/pub/mirrors/cpan.org');
 }

SUBROUTINES/METHODS

Please note that some methods may throw exceptions. Check the documentation for each method to see what exceptions may be throwned.

new()

The constructor. The constructor accepts a hash as a argument. The hash must contain 2 keys:

*) name
*) value

name can be:

*) __blank__ who specifies that the atom is a blank line
*) __comment__ who specifies that the atom is a comment
*) a string with the name of the atom

In all cases name and value must be specified, except for __blank__ atoms. new may throw the following exceptions:

*) REX::Param::Missing - when name or value are not specified
*) REX::Param::Undef - when the value of the parameters is not defined
*) REX::Param::Invalid - when the value of one of the parameters is blank or 0

Also, options accepted by Rsync::Config::Renderer can be used. Check the documentation of Rsync::Config::Renderer for a complete list of options.

is_blank()

returns true (1) if the atom is a blank atom (empty line), 0 otherwise

is_comment()

returns true (1) if the atom is a comment, 0 otherwise

name($new_name)

changes the name of the atom if $new_name is defined. Always returns the name of the atom. If this method is called outside class instance a REX::OutsideClass exception is throwned.

value($new_value)

changes the value of the atom if $new_value is defined. Else, returns the value of the atom. If this method is called outside class instance a REX::OutsideClass exception is throwned.

to_string()

returns a string representation of the atom. If this method is called outside class instance a REX::OutsideClass exception is throwned.

DEPENDENCIES

Rsync::Config::Atom depends on the following modules:

English
Scalar::Util
CLASS

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::Module Rsync::Config Rsync::Config::Renderer

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.