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
Constructors
$sympred = 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')
$sympred = 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')
$sympred = 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')
$sympred = 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$/);
$sympred = App::Chart::Sympred::Proc->new (\&proc)
-
Return a new
App::Chart::Sympred
object which calls the givenproc
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);
$sympred = 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);
Methods
$sympred->match ($symbol)
-
Return true if
$symbol
is matched by the$sympred
object. $sympred->add ($pred,...)
-
Add additional predicates to a
App::Chart::Sympred::Any
object. App::Chart::Sympred::validate ($obj)
-
Check that
$obj
is aApp::Chart::Sympred
object, throw an error if not.
HOME PAGE
http://user42.tuxfamily.org/chart/index.html
LICENCE
Copyright 2007, 2008, 2009, 2010, 2013, 2015, 2016 Kevin Ryde
Chart is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Chart is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Chart; see the file COPYING. Failing that, see http://www.gnu.org/licenses/.