NAME
Smart::Dispatch::Match - an entry in a dispatch table
DESCRIPTION
Smart::Dispatch::Match is a Moose class. (Well, Moo actually, but close enough.)
Constructor
new(%attributes)Create a new entry.
Attributes
testis 'ro', required.
dispatchis 'ro', isa 'CodeRef', predicate
has_dispatch.valueis 'ro', predicate
has_value.noteis 'ro', isa 'Str'.
is_failoveris 'ro', isa 'Bool', required, default false.
is_unconditionalis 'ro', isa 'Bool', required, default false.
Methods
value_matches($value)Perform a smart match between
$valueand thetestattribute.conduct_dispatch(@args)If the Match object has a dispatch coderef, then calls it, passing
@argsas arguments, and passing through the return value.Else if the Match object has a value, just returns it.
Otherwise returns nothing.
bitflagsReturns a number representing what sort of match this is (conditional, failover, etc), suitable for bitwise operations with the constants defined by this module.
Constants
FLAG_HAS_VALUEFLAG_HAS_DISPATCHFLAG_IS_FAILOVERFLAG_IS_UNCONDITIONAL
Overloads
Smart::Dispatch::Match overloads various operations. (See overload.)
code derefernce
&{}-conduct_dispatch.smart match
~~-value_matches.
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Smart-Dispatch.
SEE ALSO
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2012 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.