David Cantrell > App-Rsnapshot-1.999_00002 > App::Rsnapshot::Config::Node

Download:
App-Rsnapshot-1.999_00002.tar.gz

Dependencies

Annotate this POD

Module Version: 1.0   Source  

NAME ^

App::Rsnapshot::Config::Node - a node in the config file

SYNOPSIS ^

You should never need to create one of these objects from scratch. It provides methods to get at information in the XML. eg, given this and a suitably setup App::Rsnapshot::Config object:

    <rsnapshot>
      <snapshotroot nocreateroot='1'>
        /.snapshots/
      </snapshotroot>
      <externalprograms>
        <rsync binary='/usr/bin/rsync'>
          <shortargs>
            <arg>-a</arg>
            <arg>-q</arg>
          </shortargs>
          <longargs>
            <arg>--delete</arg>
          </longargs>
        </rsync>
      </externalprograms>
    </rsnapshot>

then you can get all the information about rsync thus:

    my $rsync = $config->externalprograms()->rsync();
    my $rsyncbinary = $rsync->binary();
    my $rsyncargs   = [
        $rsync->shortargs()->values(),
        $srync->longargs()->values()
    ];
    my $secondbackuppoint = $config->backuppoints()->backup(1);
    my @backuppoints = $config->backuppoints()->backup('*');

DESCRIPTION ^

Provides access to all the nodes in an App::Rsnapshot::Config object.

METHODS ^

new

Constructor, that you should never have to use.

various created by AUTOLOAD

The methods (eg binary, rsync etc) in the synopsis above are created using AUTOLOAD. The AUTOLOADer first looks for an attribute with the appropriate name and if it exists, returns its contents.

If no such attribute is found, then it looks for a child node of the appropriate type. If no parameter is given, it returns the first one.

If a numeric parameter is given it returns the Nth such node - they are numbered from 0.

If the parameter is an asterisk (*) then a list of all such nodes is returned.

Otherwise the node of the appropriate type whose ->name() method matches is returned. It is an error to try this if there's no such method.

Nodes stringify to their contents if necessary, and can also be compared for string (in)equality. Note that when stringifying, leading and trailing whitespace is removed.

values

Returns a list of the string contents of all child nodes.

BUGS/WARNINGS/LIMITATIONS ^

None known

SOURCE CODE REPOSITORY ^

http://www.cantrell.org.uk/cgit/cgit.cgi/rsnapshot-ng/

AUTHOR, COPYRIGHT and LICENCE ^

Copyright 2009 David Cantrell <david@cantrell.org.uk>

This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.

CONSPIRACY ^

This module is also free-as-in-mason software.

syntax highlighting: