The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SeeAlso::Source - a source of OpenSearch Suggestions reponses

SYNOPSIS

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

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. The optional @description parameter is passed to the description method. Instead of providing a query method by parameter you can also derive a subclass and define the mQuery method.

description ( [ $key ] | $key => $value, $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)

Example

An example query (a hash of 'id' and optional '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!

errors ( [ $message [, $message ... ] ] )

Get/add error messages.