can anyone recommend a more elegant and efficient way to achieve the same behaviour?You could use Class::Multimethods to create a "insert" that dispatches on the types of its first two arguments, then implement all the ones that make sense, and let an exception be thrown for combinations that fail.
The nice thing is that this module emulates a similar strategy for Perl6, so you'll be able to reuse your experience more directly as time passes.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to Re: "polymorphism" hack: nuts or wise?
by merlyn
in thread "polymorphism" hack: nuts or wise?
by rvosa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |