RoPkg::Simba(3) the main class of simba

VERSION

0.8.4

SYNOPSIS


!#/usr/bin/perl

use RoPkg::DB;
use RoPkg::Simba;

sub main {
my $simba = new RoPkg::Simba(cfgFile => '/etc/simba.cfg');
$simba->Run({ Name => 'debian'});
}

main();

DESCRIPTION

This class encapsulates all the necesary code required to run Simba.

SUBROUTINES/METHODS

new()

new() expects a hash ref as a parameter. The hash can contain (for the moment) only the cfgFile (the configuration file). All other hash keys are ignored.

SimbaURL

Returns the url with simba website

VERSION

Returns a string with simba version

MirrorsNo($fields)

returns the number of the mirrors from the database. The mirrors can be filtered using the $fields parameter (as documented in SQL::Abstract - where)

Mirrors($fields)

returns a array of RoPkg::Simba::Mirror initialized objects. The mirrors can be filtered using the $fields parameter (as documented in SQL::Abstract - where)

CommandsNo($fields)

returns the number of commands from the database. The commands can be filtered using the $fields parameter (as documented in SQL::Abstract - where)

Commands

returns a array of RoPkg::Simba::Command initialized objects. The commands can be filtered using the $fields parameter (as documented in SQL::Abstract - where)

ExcludeNo

returns the number of excludes from the database. The excludes can be filtered using the $fields parameter (as documented in SQL::Abstract - where)

Excludes

returns a array of RoPkg::Simba::Excludes initialized objects. The excludes can be filtered using the $fields parameter (as documented in SQL::Abstract - where)

LoadMirror($fields)

load a mirror (and the related objects: command and exclude list) from the database and return a list of 3 objects:
the mirror object (RoPkg::Simba::Mirror)
the command object (RoPkg::Simba::Command)
the excludes object (RoPkg::Simba::Excludes)

Ex:
 my ($mirror, $command$excludes);

 ($mirror, $command, $excludes) = $simba->LoadMirror({ Name => 'debian'});

The mirrors can be filtered using the $fields parameter (as documented in SQL::Abstract - where). This method also checks if all necesary values are defined and well formed; for example checks if the command file name really exists.

Run($fields)

The most used method by simba. This method loads the mirror from the database, the command and the exclude list, builds the command line (with respect to username and password if necesary), signals mirror in progress, executes the command, parses the sync raw log and updates the database. Also, the afterSync handler callback is registered to this method. The mirrors can be filtered using the $fields parameter (as documented in SQL::Abstract - where).

RunCallbacks($cbName, @mirrors)

call the plugin methods for $cbName callback name.

CheckDB()

Checks if database has at least one mirror and one command defined.

dbh()

returns the database handler used by Simba

dbo()

returns the instance of RoPkg::DB object, used by Simba

dbo_method()

returns the method used by Simba's dbo() object to access the mirrors database.

PERL CRITIC

This module is perl critic level 2 compliant (with one exception)

DIAGNOSTICS

This module has his own tests in the t directory. To run the tests, unpack the source and use 'make test' command.

CONFIGURATION AND ENVIRONMENT

This class use a configuration file. No environment variables are used. The configuration file format and the complete list of options (with detailed explanations) can be found on the community website: http://simba.packages.ro

DEPENDENCIES

INCOMPATIBILITIES

Please check the Makefile.PL for a detalied list of dependencies and their versions.

BUGS AND LIMITATIONS

No bugs known. For now, Simba can work only with rsync.

AUTHOR

Subredu Manuel <[email protected]>

LICENSE AND COPYRIGHT

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 LICENSE file contains the full text of the license.