App-Chart
view release on metacpan or search on metacpan
lib/App/Chart/Sympred.pm view on Meta::CPAN
my $sympred = App::Chart::Sympred::Equal->new ('FOO.BAR')
=item C<< $sympred = App::Chart::Sympred::Suffix->new ($suffix) >>
Return a new C<App::Chart::Sympred> object which matches the given symbol
suffix. Eg.
my $sympred = App::Chart::Sympred::Suffix->new ('.FOO')
=item C<< $sympred = App::Chart::Sympred::Prefix->new ($prefix) >>
Return a new C<App::Chart::Sympred> object which matches the given symbol
prefix. Eg.
my $sympred = App::Chart::Sympred::Prefix->new ('^NZ')
=item C<< $sympred = App::Chart::Sympred::Regexp->new (qr/.../) >>
Return a new C<App::Chart::Sympred> object which matches the given regexp
pattern. Eg.
my $sympred = App::Chart::Sympred::Regexp->new (qr/^\^BV|\.SA$/);
=item C<< $sympred = App::Chart::Sympred::Proc->new (\&proc) >>
Return a new C<App::Chart::Sympred> object which calls the given C<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);
=item C<< $sympred = App::Chart::Sympred::Any->new ($pred,...) >>
Return a new C<App::Chart::Sympred> object which is true if any of the given
C<$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);
=back
=head2 Methods
=over
=item C<< $sympred->match ($symbol) >>
Return true if C<$symbol> is matched by the C<$sympred> object.
=item C<< $sympred->add ($pred,...) >>
Add additional predicates to a C<App::Chart::Sympred::Any> object.
=item C<< App::Chart::Sympred::validate ($obj) >>
Check that C<$obj> is a C<App::Chart::Sympred> object, throw an error if not.
=back
=head1 HOME PAGE
L<http://user42.tuxfamily.org/chart/index.html>
=head1 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 F<COPYING>. Failing that, see
L<http://www.gnu.org/licenses/>.
=cut
( run in 0.753 second using v1.01-cache-2.11-cpan-39bf76dae61 )