Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: Adding Global Keyword?

by Sec (Monk)
on Feb 17, 2006 at 15:29 UTC ( #530970=note: print w/replies, xml ) Need Help??

in reply to Re: Adding Global Keyword?
in thread Adding Global Keyword?

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.

Replies are listed 'Best First'.
Re^3: Adding Global Keyword?
by dragonchild (Archbishop) on Feb 17, 2006 at 15:33 UTC
    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?
Re^3: Adding Global Keyword?
by Anonymous Monk on Feb 18, 2006 at 11:17 UTC
    I'd cheat.
    sub what::s { ... debug code here... }
    Then later, anywhere...
    what's($foo); what's($bar);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://530970]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-01-22 20:28 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (237 votes). Check out past polls.