The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Chart::Sympred -- symbol predicate objects

SYNOPSIS

 use App::Chart::Sympred;
 my $sympred = App::Chart::Sympred::Suffix->new ('.AX');
 $sympred->match('FOO.AX')  # returns true

DESCRIPTION

A App::Chart::Sympred object represents a predicate for use on stock and commodity symbols, ie. a test of whether a symbol has a certain suffix or similar.

FUNCTIONS

$sympred->match ($symbol)

Return true if $symbol is matched by the $sympred object.

App::Chart::Sympred::validate ($obj)

Check that $obj is a App::Chart::Sympred object, throw an error if not.

App::Chart::Sympred::Equal->new ($suffix)

Return a new App::Chart::Sympred object which matches only the given symbol exactly. Eg.

    my $sympred = App::Chart::Sympred::Equal->new ('FOO.BAR')
App::Chart::Sympred::Suffix->new ($suffix)

Return a new App::Chart::Sympred object which matches the given symbol suffix. Eg.

    my $sympred = App::Chart::Sympred::Suffix->new ('.FOO')
App::Chart::Sympred::Prefix->new ($prefix)

Return a new App::Chart::Sympred object which matches the given symbol prefix. Eg.

    my $sympred = App::Chart::Sympred::Prefix->new ('^NZ')
App::Chart::Sympred::Regexp->new (qr/.../)

Return a new App::Chart::Sympred object which matches the given regexp pattern. Eg.

    my $sympred = App::Chart::Sympred::Regexp->new (qr/^\^BV|\.SA$/);
App::Chart::Sympred::Proc->new (\&proc)

Return a new App::Chart::Sympred object which calls the given proc subroutine to test for a match. Eg.

    sub my_fancy_test {
      my ($symbol) = @_;
      return (some zany test on $symbol);
    }
    my $sympred = App::Chart::Sympred::Proc->new (\&my_fancy_test);
App::Chart::Sympred::Any->new ($pred,...)

Return a new App::Chart::Sympred object which is true if any of the given $pred predicates is true. Eg.

    my $nz = App::Chart::Sympred::Suffix->new ('.NZ')
    my $bc = App::Chart::Sympred::Suffix->new ('.BC')

    my $sympred = App::Chart::Sympred::Any->new ($nz, $bc);
$pred->add ($pred,...)

Add additional predicates to a App::Chart::Sympred::Any object.