in reply to I don't care about *your* warnings!

This is why it is a sin to "use warnings" in modules. :) I never do that. I always do "-w" in my *.t files instead.

If I want to see warnings from your module, then I'll use "-w". You shouldn't be telling me whether or not I want to see warnings from your module.

I actually hope that there is some warnings.pm magic that would let me turn on/off warnings from a specific package but nobody so far is familiar with such a feature (and I'm not and I don't see such documented in warnings).

You could certain go the moderately ugly route of writing a $SIG{__WARN__} handler to throw such away.

And you can use -X to disable all warnings. But I got the impression that you wanted to see your own warnings.

I'd certainly patch Contextual::Return to not "use warnings" (and add -w to all of the *.t files) and submit that back to the module's maintainer.

And it looks like there is room for improvement in making it easy to ignore warnings from a specific module (that did "use warnings" and didn't test well enough, likely).

- tye        

  • Comment on Re: I don't care about *your* warnings! (-X)

Replies are listed 'Best First'.
Re^2: I don't care about *your* warnings! (-X)
by ruzam (Curate) on Feb 28, 2007 at 21:10 UTC
    Seems to me the sin wasn't the use of "use warnings" but rather lack of attention to warnings. If one is going to put a module out there for the world to use, it better darn well be robust enough to handle any situation that could result in a warning instead of just causing it.

    But this is just my opinion and off topic to boot :)
Re^2: I don't care about *your* warnings! (-X)
by DrHyde (Prior) on Mar 01, 2007 at 11:03 UTC
    My modules spit out warnings when you do something stupid with them, or in a few cases when there is a non-fatal error. They are intended to be useful both for programmers using my modules and for users of your modules.

    I do try to remember to document what warnings I might spit out, so if you really want to hide errors from your users you can, by catching my warnings in a local $SIG{__WARN__}. Anywhere that I don't document my warnings I consider to be a bug, so please report such things using RT.