Your sample program is a bit convoluted to be useful, so I wrote my own:
#!/usr/bin/perl use Carp; eval { croak "With a newline\n" }; print $@; eval { croak "No newline" }; print $@;
Here's my output on perl v5.8.4 built for darwin-2level. With a newline, there is nothing after the message "With a newline", although croak still tell me where it happened. After the message "No newline", I get the file name and line number, and croak still tells me a little bit about where this happened.
With a newline eval {...} called at croak.pl line 5 No newline at croak.pl line 7 eval {...} called at croak.pl line 7
This is the output I expect: If I'm using croak(), I want that information about the caller. That's a separate issue from tacking on the filename and line number though.
In reply to Re: croak not like die.
by brian_d_foy
in thread croak not like die.
by esharris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |