Re: fun with hashes!
Uri Guttman <[email protected]> Fri, 23 Nov 2007 23:54:40 -0500
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "SHC" == Shawn H Corey <[email protected]> writes: SHC> Vladi Belperchinov-Shabanski wrote: >> On Fri, 23 Nov 2007 23:18:20 +0100 >> "A. Pagaltzis" <[email protected]> wrote: >> >>> * Jerrad Pierce <[email protected]> [2007-11-23 22:50]: >>>> exists( $dispatch{$sub} ) ? $dispatch{$sub}->() : >>>> warn "Key <$sub> does not exist in the dispatch table"; >>> ( $dispatch{$sub} || sub { warn "no such action '$sub'" } )->(); >>> >> or &{ ... || ... }->() >> just to avoid problems like: >> print ( $dispatch{$sub} || sub { warn } )->(); SHC> And you wonder why I dislike dispatch tables? So simple in SHC> concept, so ugly in reality. s/dispatch tables/inheritance/g ; :) uri -- Uri Guttman ------ [email protected] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org