In case you just want to ward off all error messages from the module in which you “
use Carp::Clan”, i.e., if you want to make all error messages or warnings to appear to originate from where your module was called (this is what you usually used to “
use Carp;” for
;-)), instead of in your module itself (which is what you can do with a “
die” or “
warn” anyway), you do not need to provide a pattern, the module will automatically provide the correct one for you.
Before I discovered this module, I would play silly games with
local $Carp::CarpLevel = $Carp::CarpLevel + 1 sprinkled all over the place. Not only was that annoying, it also hatefully causes Carp to emit verbose messages. Now I just
use Carp::Clan and things work as I meant them to.
My only question is: why is this not part of the core? Why indeed doesn’t Carp itself work that way?