http://qs321.pair.com?node_id=11119557


in reply to carp always showing stacktrace

You are not calling the sub from a different module. The Carp documentation says right at the top (emphasis mine):

For a shorter message you can use carp() or croak() which report the error as being from where your module was called. shortmess() returns the contents of this error message.

Therefore this carps with the context of the call in main only:

use strict; use warnings; package Foo; use Carp; sub dbout { carp "@_"; } package main; Foo::dbout (1..3);

Here's the STDERR:

1 2 3 at /tmp/lanxcarp.pl line 14.