|Perl: the Markov chain saw|
Re^5: A short, "iffy" rantby jryan (Vicar)
|on Oct 18, 2004 at 00:19 UTC||Need Help??|
What problem were you trying to address when you wrote this?
Modularity, Maintenance - the usual suspects. Exporter::Dispatch isn't really aimed at dispatch tables of 3 or 4 subs of 1 line a piece - its aimed for use with large dispatch tables. For instance, the last time I used it was on a project with 4 dispatch tables, each having between 10-30 subroutines, with each subroutine varying in length from 10-60 lines.
As for closing over lexical variables, you can still do that if the subs are in a separate package - you just put the declaration in the same package as the rest of the dispatch table subs are defined!
But, as for:
And a further hash advantage - you are allowed names that would not easy or (in some cases) legal in Perl function names.
What does that buy you? The only time I think I've ever used a dispatch table that had non-word dispatch names was this:
This was part of a very simple simulator that I wrote for a language that we have compiled down to 68HC11, and the only reason I wrote it this way was so I could use the raw token as the hash key.