Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: carp always showing stacktrace

by hippo (Chancellor)
on Jul 20, 2020 at 17:19 UTC ( #11119557=note: print w/replies, xml ) Need Help??

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/ line 14.

Replies are listed 'Best First'.
Re^2: carp always showing stacktrace
by LanX (Cardinal) on Jul 20, 2020 at 17:23 UTC
    > You are not calling the sub from a different module.

    Argh damn ... we had this discussion before...

    Thanks! :)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11119557]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2020-09-28 00:44 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (143 votes). Check out past polls.