Rene Schickbauer

NAME

Maplat::Worker::BaseModule - base module for worker modules

SYNOPSIS

This module is the base module any worker module should use.

DESCRIPTION

When writing a new worker module, use this module as a base:

  use Maplat::Worker::BaseModule;
  @ISA = ('Maplat::Worker::BaseModule');

new

This creates a new instance of this module. Do not call this function directly, use the "configure" call in Maplat::Worker.

register

This function needs to be overloaded in every worker module. This function is run during startup once some time after new(). Within this function (and ONLY within this function) you can call register_worker() to register cyclic functions.

reload

This function is called some time after register() and may be called again while the worker is running. Everytime reload() is called, you should empty all cached data in this worker and reload it from the sources (if applicable).

register_worker

This function registers a function of its own module as a cyclic worker function. It takes one argument, the name of the cyclic function, for example:

  ...
  sub register {
    $self->register_worker("doWork");
  }
  ...
  sub doWork {
    # update file $bar with @foo
    ...
  }

It is possible to register multiple cyclic functions within the same worker module.

register_cleanup

Register a callback for "cleanup" operations after a workcycle has been completed. This might for example be a function in a database module that makes sure there are no open transactions.

Configuration

This module is not used directly and doesn't need configuration.

Dependencies

This module does not depend on other worker modules

SEE ALSO

Maplat::Worker

AUTHOR

Rene Schickbauer, <rene.schickbauer@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008-2011 by Rene Schickbauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.