But (you knew that was coming) the exact question which started this dicussion was you recommending the use of $Carp::CarpLevel for wrapping a module. Which is exactly what you said that you don't do.
Despite your assertion that you don't hardcode $Carp::CarpLevel, your example did. If you want to let your caller be more flexible in what they are going to do, you need to:
If you do that, then someone calling your code can decide to edit themselves out of the calling stack. Else they can't.{ local $Carp::CarpLevel = $Carp::CarpLevel + 2; carp("That isn't nice!"); }
Further than that, I note that while it may be possible to figure out the call-level that an error will be called from, that imposes extremely strong requirements on the structure of the code. And even where you had that structure once, it generally doesn't last. (It didn't for Exporter.)
As for longer term solutions, please download the current development series and take a look at what is offered in its Carp. If that doesn't offer the control that you want, now is the time to raise your voice...
In reply to Re (tilly) 6: Confusion about properly using Carp
by tilly
in thread Confusion about properly using Carp
by jeffa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |