Sub-Multi

 view release on metacpan or  search on metacpan

lib/Sub/Multi.pm  view on Meta::CPAN

times with the same C<$sub_name> to build a multi-dispatch method. 

I<TODO: Verify this statement:> Before the method is actually dispatched, 
a call to Data::Bind->sub_signature should be made to register the subroutine
signature. 

=cut

sub add_multi {
    my ($class, $name, $sub) = @_;
    my $pkg = ((caller)[0]);
    no strict 'refs';
    my $subs = ${$pkg."::SUB_MULTI_REGISTRY"} ||= [];
    push @$subs, $sub;
    no warnings 'redefine';
    *{$pkg."::$name"} = $class->new(@$subs);
}

sub dispatch {
    my $class = shift;
    my $subs = shift;



( run in 0.417 second using v1.01-cache-2.11-cpan-a3c8064c92c )