Help for this page

Select Code to Download


  1. or download this
    use CGI qw(:all);
    my $op = param('operation');
    
    TestPkg->$dispatch('Hello!') if UNIVERSAL::can('TestPkg', $dispatch);
    
  2. or download this
    my $input = <>;
    
    $_->($input) for
        map /^_/ ? () : *{$TestPkg::{$_}}{CODE} || (),
        keys %TestPkg::;
    
  3. or download this
    my $input = <>;
    
    my $sub;
    !/^_/ && *$sub{CODE} && *$sub{CODE}->($input)
        while ($_, $sub) = each %TestPkg::;
    
  4. or download this
    package Foo;
    use Dispatch;
    ...
    
    my $t = Foo->create_dptable;
    $t->{bar}->($quux);
    
  5. or download this
    my $t = {
        bar => sub {
    ...
    };
    
    $t->{bar}->($quux);