Help for this page

Select Code to Download


  1. or download this
    my %dispatch = (
      Foo => \&_foo,
      Bar => \&_bar,
    ...
      my $method = $dispatch{$type} || die "Can't find method ...";
      $self->$method($data);
    }
    
  2. or download this
    multimethod process (Foo $thing, String $data) { ... }
    
    multimethod process (Bar $thing, String $data) { ... }
    
    multimethod process (Baz $thing, String $data) { ... }
    
  3. or download this
    sub name {
      my ($self, $name) = @_;
      $self->{name} = $name if $name;
      return $self->{name};
    }