Method-ordered multimethod dispatch
You can define multimethods with the "multi" declarator: use Class::Multimethods::Pure; multi collide => ('Bullet', 'Ship') => sub { my ($a, $b) = @_; ... }; multi collide => ('Ship', 'Asteroid') => sub { my ($a, $b) = @_; ... }; It is usually wise to put such declarations within a BEGIN block, so they behave more like Perl treats subs (you can call them without parentheses and you can use them before you define them).
$
pkg install p5-Class-Multimethods-PureOrigin
devel/p5-Class-Multimethods-Pure
Size
49.0KiB
License
not specified
Maintainer
perl@FreeBSD.org
Dependencies
1 packages
Required by
1 packages