in reply to Find the name of a CODEref

It would be better to simply return undef than die if it's not a code ref wouldn't it? Perhaps die if it is a coderef but you can't find it?


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Find the name of a CODEref
by jdporter (Paladin) on Aug 25, 2006 at 12:58 UTC
    It would be better to simply return undef than die if it's not a code ref wouldn't it?

    Well that's largely dependent on the coding conventions for you/your project. But in general I'd say No, it makes more sense to die, because it likely represents a programming error, which you'd like to catch during development. Put another way: it's probably better to ensure a priori that only code refs are being passed in, than to have to try to handle errors resulting from passing a non-code-ref.

    We're building the house of the future together.