Class::Multimethods::PureClass::Multimethods::Pure is a Perl module that contains a method-ordered multimethod dispatch. | |
Download |
Class::Multimethods::Pure Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Luke Palmer
- Publisher web site:
- http://search.cpan.org/~lpalmer/Symbol-Opaque-0.03/lib/Symbol/Opaque.pm
Class::Multimethods::Pure Tags
Class::Multimethods::Pure Description
Class::Multimethods::Pure is a Perl module that contains a method-ordered multimethod dispatch. Class::Multimethods::Pure is a Perl module that contains a method-ordered multimethod dispatch.SYNOPSIS use Class::Multimethods::Pure; package A; sub magic { rand() > 0.5 } package B; use base 'A'; package C; use base 'A'; BEGIN { multi foo => ('A', 'A') => sub { "Generic catch-all"; }; multi foo => ('A', 'B') => sub { "More specific"; }; multi foo => (subtype('A', sub { $_->magic }), 'A') => sub { "This gets called half the time instead of catch-all"; }; multi foo => (any('B', 'C'), 'A') => sub { "Accepts B or C as the first argument, but not A" }; } Requirements: · Perl
Class::Multimethods::Pure Related Software