Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Basically, you're trying to come up with an API for a generalized switch statement without using source filters in Perl5. The actual mechanics, frankly, are irrelevant.
While I don't have much in the way of implementation suggestions, I do have a few requirements that I'd like to see from a switch statement. You may already implement some of these - I haven't checked.
Taking a page from Class::MakeMethods, it might be useful to have each case be an arrayref. The last value is the action to take. All others are the case options. If the first value begins with '--', then it's an optional modifier to how to handle the next case option. So, maybe something like:
That would be a useful module.
In reply to Re: Switch/case as a jump table with C-style fall-through
by dragonchild
|
|