[Pdx-pm] OT given/when in Perl5
Eric Wilhelm
scratchcomputing at gmail.com
Fri May 19 21:57:09 PDT 2006
Hi all,
I got to thinking about how a switch syntax might be done in Perl5 with
a little prototype-based syntactic sugar.
http://scratchcomputing.com/tmp/given_when.pl
(This is just a first hack to work out the semantics.)
I suppose it could have {} instead of [] if when() did something
inside-outish (plus sorting) to allow for the flattening of hash keys.
Is the square-bracket syntax too horrid? If so, how do I do thread-safe
and otherwise-safe storage of the when() values? Package variable hash
plus some thread-specific key? UUID chosen by default()? (it gets
called first.)
Anyone seen this in Perl5 besides Damian's (source filter) Switch.pm?
(from which I fully intend to steal the "if()" and "$::_S_W_I_T_C_H ="
stuff.)
--Eric
--
"It ain't those parts of the Bible that I can't understand that
bother me, it's the parts that I do understand."
--Mark Twain
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
More information about the Pdx-pm-list
mailing list