in reply to Adding Global Keyword?

What's wrong with following 50 years of good coding practices and adding a single line to each package that uses your dwim() to explicitly import it? Otherwise, you're creating a maintenance nightmare for the poor schlup who has to read your code in 6 months.

Remember, what you think of as a good idea right now will be cursed by the guy who reads it. 90% of the time, that guy will be you. If you want to do something because it's "clever", remember that's code for "stupid".


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: Adding Global Keyword?
by Sec (Monk) on Feb 17, 2006 at 15:29 UTC
    The question came from a friend, who wanted to use it just temporarily for debugging. He didn't want to import his "Debugging module" in every single package.
    I know that in this case "Module::debug()" works. I looked into this problem out of sheer curiosity. It feels strangely unperlish to me that perl allows me to override existing builtin keywords, but not add my own.
      Look into if and conditional compilation using constants.

      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      I'd cheat.
      sub what::s { ... debug code here... }
      Then later, anywhere...
      what's($foo); what's($bar);