Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Redefining Imported Subs: of scope and no

by temporal (Pilgrim)
on Feb 11, 2013 at 16:40 UTC ( [id://1018179]=note: print w/replies, xml ) Need Help??


in reply to Redefining Imported Subs: of scope and no

Whoa, had no idea that this would spark such a lively discussion. Excellent.

I had intended to use say as an example - but it turned out to be the problem, huh? Ha! Go figure.

LanX - did not know about use if, so that's a neat plus. Hopefully you haven't quite yet learned your lesson about reading and replying to my ridiculously long posts ♥

Also comforting is that most of my solutions will work with normal non-CORE:: namespace imports.

As for all the advice in regards to how I ran into this question - debug output style/best practices and such - in the future I'll be going with aitap's great suggestion: Log::Log4perl. Very flexible and feature-rich, thanks for the tip!

BrowserUk, after diving the rabbit hole of replies, my question is/was/will be where do these definitions reside and how do I get at them?
Not so much how to get around a silly design decision I made =D
As usual, thanks for pointing me towards some great reading material. I'll definitely be playing around with Devel::Pragma to investigate any future questions in this vein.

So here we go:

  • say lives in CORE::, where it can (usually) be accessed
  • See ex::override for overriding CORE:: functions.
  • use feature 'say' enables say as an operator - which means that once created it cannot be redefined.
  • use if works, but has some constraints concerning order of your sub and verbosity definitions.
  • Using say for debugging is silly - but educational!

Thanks to all of you for the great replies and entertaining repartee ;)

Strange things are afoot at the Circle-K.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1018179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (None)
    As of 2024-04-25 03:58 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found