NAME

WebSource::Module : WebSource module - class from which all modules inherit Each module needs to define a handler method.

SYNOPSIS

{ package MyModule; our @ISA=('WebSource::Module');

sub handler {
  my ($self,$val) = @_;
  # do something with $val and produce @res
  return @res;
}

}

my $m = MyModule->new( name => "GiveMeAName", queue => $queue );

... do some stuff ...

$m->forwardTo($queue);

... do some stuff ...

$m->run->join();

METHODS

$mod = WebSource::Module->new( name => $name )

Create a new instance of module;

$mod->_init_

Does some initializations. Any operator $op inheriting from WebSource::Module should call $op->SUPER::_init_ inside a redefined _init_ method.

$mod->log($level,$message)

Use this modules logger to log a message $message with priority level $level. This is actually used internally. Any inheriting module is encouraged to use the logging facility.

$mod->will_log($level)

Use this modules logger to check if a message at level $level will be logged. This is actually used internally. Any inheriting module is encouraged to use the logging facility.

$mod->set_logger($log)

Sets the logger associated to this module

$mod->push($val)

Push $val into the module. This handles the given value and stores it onto the stock.

$mod->producers(@modules)

Add a list of modules from where to ask for data (ie. set @modules as producers of this module). Also sets this module as a consumer of each of the modules in @modules.

Note : Only producers or consumers calls should be used

$mod->consumers(@modules)

Add a list of modules where results should be sent to (ie. set @modules as consumers of this modules production). Also sets this module as a producer of each of the modules in @modules.

Note : Only producers or consumers calls should be used

$self->produce

Ask this module to produce a result. If some are available in the stock, the first is sent to its consumers. If not, more results are produced by asking the producers of this module to produce more.

If a result is produced it is forwarded to the modules consumers and returned. If no results can be produced undef is returned. (However if in a consumer, with an originally empty stock, a simpler test on the stock after having called produce on a producer will do).

$mod->start()

Called at before production has started

$mod->end()

Called when production has ended (no more producers have data)

$mod->handle($val)

Called internally by push (ie. when data arrives). When a value $val arrives, $module->handle($val) is called which produces @res. The resulting values are stored onto the stock;

SEE ALSO

WebSource::Fetch, WebSource::Extract, etc.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 328:

You forgot a '=back' before '=head1'