A. Pagaltzis wrote:
* Mr. Shawn H. Corey <[EMAIL PROTECTED]> [2007-11-24 00:50]:
my $sub = ( exists $dispatch{ $key } && ref( $dispatch{ $key } ) eq 'CODE' )
? $dispatch{ $key }
: $dispatch{ 'default' };
Just because you're not paranoid doesn't mean computers don't
hate you :)
So why did you skip the check for whether the default value is
a CODE ref?
Because I don't like dispatch tables. When I see them I want to convert the whole thing
to objects and starting thinking about inheritance and polymorphism. Which will take
care of such problems at "compile" time.
But this thread is about hashes not objects.
(And I still think computers hate me.)
--
Just my 0.00000002 million dollars worth,
Shawn
+------------\
| Shangri La \
| 40,000 km /
+------------/