Steve Purkis > Pangloss > Pangloss::Search::Filter

Download:
Pangloss-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

Pangloss::Search::Filter - abstract search filter

SYNOPSIS ^

  # abstract - must be sub-classed for use
  use Pangloss::Search::Filter::Foo;

  my $filter = $Pangloss::Search::Filter::Foo->new;

  do { ... } if $filter->parent( $self )->applies_to( $term );

DESCRIPTION ^

An abstract search filter object.

METHODS ^

$bool = $obj->applies_to( $term )

abstract. test to see if this filter applies to the Pangloss::Term given. a return value of true indicates that the $term should be added to the result set.

$obj->parent

get/set this filter's parent Pangloss::Search.

SUB-CLASSING ^

At the very least, you must do the following:

  package Foo;
  use base qw( Pangloss::Search::Filter );

  sub applies_to {
      my $self = shift;
      my $term = shift;

      # use $term and the collections available
      # via $self->parent to do your test

      return 0 || 1;
  }

Pangloss::Search will set $self->parent() before it calls applies_to().

AUTHOR ^

Steve Purkis <spurkis@quiup.com>

SEE ALSO ^

Pangloss::Search, Pangloss::Search::Request, OpenFrame::WebApp::Error::Abstract

Known Sub-Classes

Pangloss::Search::Filter::Base, Pangloss::Search::Filter::Keywords

syntax highlighting: