NAME

SeeAlso::Source - An source of OpenSearch Suggestions reponses

SYNOPSIS

my $source = SeeAlso::Source->new();
my $source = SeeAlso::Source->new( sub { ... } );

new ( $query_method [, %description ] )

Create a new source. You can provide a query method (mQuery). The query method gets a SeeAlso::Identifier object and must return a SeeAlso::Response.

query ( $identifier )

Gets a SeeAlso::Identifier object and returns a SeeAlso::Response object. If you override this method, make sure that errors get catched!

By default an empty result always contains the normalized form of the identifier.

description ( [ $key [, $value] ] )

Returns additional description about this source in a hash (no key provided) or a specific element of the description. The elements are defined according to elements in an OpenSearch description document. Up to now they are:

ShortName

A short name with up to 16 characters.

LongName

A long name with up to 48 characters.

Description

A description with up to 1024 characters.

BaseURL

URL of the script. Will be set automatically via CGI if not defined.

DateModified

Qualified Dublin Core element Date.Modified.

Source

Source of the data (dc:source)

errors

get/add error messages

hasErrors

Return whether errors occured

TODO

The description method should support more fields and add a check for known field values (maybe a special OpenSearchDescription class should be created).