Author image Kenneth Ingham


IDS::DataSource - A data source for the IDS test framework.


A usage synopsis would go here. Since it is not here, read on.


new(source, params)

Create the object for the data source. If the parameters are supplied, they are used; otherwise everything is defaults (unsurprisingly).

If a data source is supplied, it is the source passed to a load operation. A source may be a file name, file handle, or other source understood by the IDS::DataSource subclass.

The parameters affect how the algorithm operates. See the specific source for most parameter information. General parameters are described below.

In simple cases, this function can be used instead of the subclass version.

parameters(param, value, ...)

Set or retrieve the current parameters (individual or group).


The following parameters are expected to be used (when the use makes sense) by all subclasses.


How much ``extra'' information to provide as we are working. 0 means nothing other than warnings and errors. Increasing values mean increasing output, but these details are left to the subclasses.


Where warning and error messages go; nowhere if undefined.

Additionally, subclasses may define their own parameters.

All subclasses must define all parameters to default values when new() is called. This is so the param_options can be properly handled.


These are options definitions for Getopt::Long.

Utility functions

These may be useful for subclasses.

handle_parameters($self, @_)

Handle the parameter string that IDS::Algorithm::new() will accept. Extracted from new() for subclass usage. Returns a filehandle or filename if we were called with a filehandle/filename from which to load.


Set all of the parameters to default values.


Load a single instance from the source (filename or filehandle) provided. This function must be implemented in the subclass.

foreach(source, coderef, object)

Read a series of instances (from the source specified), and call the function pointed to by coderef, which is associated with the object provided. This function may be overridden in the subclass.

The function to call is called as:

&$coderef($object, tokenref)

mesg(level, message)
mesg(level, message, separator, arrayref)

Print a message if the verbosity level warrants it. If the separator and array reference are provided, the array referenced is joined with the separator provided and the result is appended to the message provided.

A message is produced only if the current verbosity level >= level.

warn(message, arrayref, token)

Print a warning message, and optionally push a warning token on the referenced array (if return_warnings is set).


Copyright 2005-2007, Kenneth Ingham. All rights reserved.

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

Address bug reports and comments to: ids_test at When sending bug reports, please provide the versions of,,, the version of Perl, and the name and version of the operating system you are using. Since Kenneth is a PhD student, the speed of the response depends on how the research is proceeding.


Please report them.


IDS::Test, IDS::Algorithm