|Problems? Is your data what you think it is?|
Re^5: RFC: Defined-Or for before Perl 5.10by afoken (Parson)
|on Nov 10, 2010 at 22:20 UTC||Need Help??|
def_or is a good name, short and quite obvious. Many computer languages use "def" as a shortcut for "define" or "defined". So, no surprises here.
dor_call, on the other hand, is not so obvious, you have cut away too much. What the heck is "dor"? A mis-spelled door? And what would be a door-call? "Don't make me think!" def_or_call is longer, but also clearer.
So, now that I have def_or_call(), my code will very soon look very ugly and my fingers will bleed from the many keystrokes that I need:
So, I think you should really provide def(ined)_or_die and def(ined)_or_warn. Sure, it is more work than the other functions. You should really look into the Carp sources to see how they cope with the problems your module will also have. Like I said, I'm very sure that you can use Carp for the line number problem. You could load it at runtime, inside def_or_die()/def_or_warn(). Something like this:
And I think you should also provide their Carp equivalents, for the same reasons. You could export them on demand only, and load Carp at runtime. Something like this:
Support for CGI::Carp would look about like this:
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)