The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

slackget10 - The main slack-get 1.0 library

VERSION

Version 0.08

SYNOPSIS

slack-get (http://slackget.infinityperl.org) is an apt-get like tool for Slackware Linux. This bundle is the core library of this program.

The name slackget10 means slack-get 1.0 because this module is complely new and is for the 1.0 release. It is entierely object oriented, and require some other modules (like XML::Simple, Net::Ftp and LWP::Simple).

This module is still pre-in alpha development phase and I release it on CPAN only for coder which want to see the new architecture. For more informations, have a look on subclasses.

    use slackget10;

    my $sgo = slackget10->new(
        -config => '/etc/slack-get/config.xml',
        -name => 'slack-getd',
        -version => '1.0.1228'
    );
    
    $sgo->log()->Log(1,"A log message") ;
    

CONSTRUCTOR

The constructor (new()), is used to instanciate all needed class for a slack-get instance.

new

You have to pass the followings arguments to the constructor :

        -config => the name of the configuration file.
        -name => the name of the application wich create 
        -version => the version of the calling program

-name and -version arguments are passed to the constructor of the slackget10::Log object.

FUNCTIONS

load_plugins

Search for all plugins in the followings directories : <all @INC directories>/lib/slackget10/Plugin/, <INSTALLDIR>/lib/slackget10/Plugin/, <HOME DIRECTORY>/lib/slackget10/Plugin/.

When you call this method, she scan in thoses directory and try to load all files ending by .pm. The loading is in 4 times :

1) scan for plug-in

2) try to "require" all the finded modules.

3) Try to instanciate all modules successfully "require"-ed. To do that, this method call the new() method of the plug-in and passed the current slackget10 object reference. The internal code is like that :

        # slackget10::Plugin::MyPlugin is the name of the plug-in
        # $self is the reference to the current slackget10 object.
        
        my $plugin = slackget10::Plugin::MyPlugin->new( $self ) ;

The plug-in can internally store this reference, and by the way acces to the instance of this objects : slackget10, slackget10::Base, slackget10::Config, slackget10::Network::Auth and slackget10::PkgTools.

IN ALL CASE, PLUG-INS ARE NOT ALLOWED TO MODIFY THE slackget10 OBJECT !

For performance consideration we don't want to clone all accesible objects, so all plug-in developper will have to respect this rule : you never modify object accessible from this object ! At the very least if you have a good idea send me an e-mail to discuss it.

4) dispatch plug-ins' instance by supported HOOK.

Parameters :

1) An ARRAY reference on supported Hooks.

2) the type of plug-in you want to load.

Ex:

        $sgo->load_plugins( ['HOOK_COMMAND_LINE_OPTIONS','HOOK_COMMAND_LINE_HELP','HOOK_START_DAEMON','HOOK_RESTART_DAEMON','HOOK_STOP_DAEMON'], 'daemon');

call_plugins

Main method for calling back differents plug-in. This method is quite easy to use : just call it with a hook name in parameter.

call_plugins() will iterate on all plug-ins wich implements the given HOOK.

        $sgo->call_plugins( 'HOOK_START_DAEMON' ) ;

Additionaly you can pass all arguments you need to pass to the callback which take care of the HOOK. All extra arguments are passed to the callback.

Since all plug-ins have access to many objects which allow them to perform all needed operations (like logging etc), they have to care about output and user information.

So all call will be eval-ed and juste a little log message will be done on error.

ACCESSORS

log

Return the log object of the current instance of the slackget10 object.

        $sgo->log()->Log(1,"This is a log message\n") ;

base

Return the slackget10::Base object of the current instance of the slackget10 object.

        $sgo->base()->compil_package_directory('/var/log/packages/');

pkgtools

Return the slackget10::PkgTools object of the current instance of the slackget10 object.

        $sgo->pkgtools()->install( $package_list ) ;

config

Return the slackget10::Config object of the current instance of the slackget10 object.

        print $sgo->config()->{common}->{'file-encoding'} ;

auth

Return the slackget10::Network::Auth object of the current instance of the slackget10 object.

        $sgo->auth()->can_connect($client) or die "Client not allowed to connect here\n";

AUTHOR

DUPUIS Arnaud, <a.dupuis@infinityperl.org>

BUGS

Please report any bugs or feature requests to bug-slackget10@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=slackget10. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005 DUPUIS Arnaud, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.