Koha::RecordProcessor - Dispatcher class for record normalization
use Koha::RecordProcessor; my $normalizer = Koha::RecordProcessor(%params); $normalizer->process($record)
Dispatcher class for record normalization. RecordProcessors must extend Koha::RecordProcessor::Base, be in the Koha::Filter namespace, and provide the following methods:
filter ($record) - apply the filter and return the result. $record may be either a scalar or an arrayref, and the return result will be the same type.
These methods may be overriden:
initialize (%params) - initialize the filter
destroy () - destroy the filter
These methods should not be overridden unless you are very sure of what you are doing:
new () - create a new filter object
Note that the RecordProcessor will not clone the record that is passed in. If you do not want to change the original MARC::Record object (or whatever type of object you are passing in), you must clone it prior to passing it off to the RecordProcessor.
my $normalizer = Koha::RecordProcessor->new(%params);
Create a new normalizer. Available parameters are:
Which metadata schema is in use. At the moment the only supported schema is 'MARC'.
What filter(s) to use. This must be an arrayref to a list of filters. Filters can be specified either with a complete class path, or, if they are in the Koha::Filter::${schema} namespace, as only the filter name, and "Koha::Filter::${schema}" will be prepended to it before the filter is loaded.
$processor->options( $new_options );
Overloaded accessor, that spreads the new options to the filter objects when set
$normalizer->bind($record)
Bind a normalizer to a particular record.
my $newrecord = $normalizer->process([$record])
Run the record(s) through the normalization pipeline. If $record is not specified, process the record the normalizer is bound to. Note that $record may be either a scalar or an arrayref, and the return value will be of the same type.
my @available_filters = Koha::RecordProcessor::AvailableFilters([$schema]);
Get a list of available filters. Optionally specify the metadata schema. At present only MARC is supported as a schema.