[Chicago-talk] fun with Carp

Mike Fragassi frag at ripco.com
Tue Jul 31 13:51:53 PDT 2007


On Tue, 31 Jul 2007, Kent Cowgill wrote:

> Is this what you're looking for:
>
> $Carp::CarpLevel = 1;
>
>
> $ perl ctest.pl
> attempt failed; quitting at ctest.pl line 17
>         main::quit_gracefully('attempt failed; quitting') called at ctest.pl line 5

That's better, but really I want croak() to only give me a one-line
die message:
>         quit_gracefully('attempt failed; quitting') called at ctest.pl line 5

Also, it doesn't really help, as it just chops off one level.  I really 
want it to go to the end of the stack, even if the number of levels 
vary.

Also, the comments in Carp say that CarpLevel is deprecated.

On Tue, 31 Jul 2007, Pete Krawczyk wrote:

> If you don't care about the function arguments upstream, Sub::UpLevel will
> do what you want:

Unfortunately I do care; I want croak()-style output.

On Tue, 31 Jul 2007, Steven Lembark wrote:

> Check if something you are using is setting:
>
>  $Carp::Verbose = 1;

The code in my mail is the example, and I tried making that = 0 right 
before the croak().

-- Mike F.


More information about the Chicago-talk mailing list