Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: When should I use a dispatch table?

by jdporter (Paladin)
on Dec 01, 2006 at 18:07 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://587246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-23 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found