Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: When should I use a dispatch table?

by jdporter (Canon)
on Dec 01, 2006 at 18:07 UTC ( #587246=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %real_functions = (
      wipe_system => sub { system "rm -rf /" },
    ...
        : \%real_functions;
    
    $funcs->{'wipe_system'}->();
    
  2. or download this
    {
        package SystemFunctions::Real;
    ...
        : 'SystemFunctions::Debug';
    
    $funcs->wipe_system();
    
  3. or download this
    my %dispatch = (
      incr => sub { $x++ },
      decr => sub { $x-- },
    );
    $dispatch{$op}->();
    
  4. or download this
    sub incr { shift; $x++ }
    sub decr { shift; $x-- }
    
    main->$op();
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://587246]
help
Chatterbox?
[Corion]: :-D
[Eily]: congrats Discipulus :)
[Eily]: (somehow I just typed "cong" and chrome proposed to complete the message :D )
[shmem]: Discipulus: well, a node with just one glaring truth on it is most easily upvoted ;-)
[Discipulus]: i'd like to be the vote fairy just one month.. ;=)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-04-26 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (473 votes). Check out past polls.