Smart::Dispatch::Match - an entry in a dispatch table
Smart::Dispatch::Match is a Moose class. (Well, Moo actually, but close enough.)
new(%attributes)
Create a new entry.
test
is 'ro', required.
dispatch
is 'ro', isa 'CodeRef', predicate has_dispatch.
has_dispatch
value
is 'ro', predicate has_value.
has_value
note
is 'ro', isa 'Str'.
is_failover
is 'ro', isa 'Bool', required, default false.
is_unconditional
value_matches($value)
Perform a smart match between $value and the test attribute.
$value
conduct_dispatch(@args)
If the Match object has a dispatch coderef, then calls it, passing @args as arguments, and passing through the return value.
@args
Else if the Match object has a value, just returns it.
Otherwise returns nothing.
bitflags
Returns a number representing what sort of match this is (conditional, failover, etc), suitable for bitwise operations with the constants defined by this module.
FLAG_HAS_VALUE
FLAG_HAS_DISPATCH
FLAG_IS_FAILOVER
FLAG_IS_UNCONDITIONAL
Smart::Dispatch::Match overloads various operations. (See overload.)
code derefernce &{} - conduct_dispatch.
&{}
conduct_dispatch
smart match ~~ - value_matches.
~~
value_matches
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Smart-Dispatch.
Smart::Dispatch.
Toby Inkster <tobyink@cpan.org>.
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.
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.
To install Smart::Dispatch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Smart::Dispatch
CPAN shell
perl -MCPAN -e shell install Smart::Dispatch
For more information on module installation, please visit the detailed CPAN module installation guide.