From the docs:
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.
Of course, that’s not the module’s only use – but that alone makes the module worthwhile to use everywhere, even if you don’t have a “clan” of modules.
My only question is: why is this not part of the core? Why indeed doesn’t Carp itself work that way?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|