Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Should I use carp/croak or warn/die (@CARP_NOT)

by Anonymous Monk
on May 30, 2018 at 21:52 UTC ( #1215510=note: print w/replies, xml ) Need Help??


in reply to Re^2: Should I use carp/croak or warn/die (@CARP_NOT)
in thread Should I use carp/croak or warn/die

Though I'm not sure if @CARP_NOT could be used for this ...
How could it?

I mean @CARP_NOT is a package variable that is (or so I suppose) evaluated at compile-time.

How could that be used to implement the run-time feature of reporting the the first caller of a different package?

I don't really know to be honest, you could be right, but my working hypothesis here is that you're simply blah-blahing here.

So please enlighten us...

  • Comment on Re^3: Should I use carp/croak or warn/die (@CARP_NOT)

Replies are listed 'Best First'.
Re^4: Should I use carp/croak or warn/die (@CARP_NOT)
by LanX (Sage) on May 30, 2018 at 22:29 UTC
    I wouldn't ask if I knew.

    > evaluated at compile-time.

    nope that's obvious from the docs and from a simple test.

    > you're simply blah-blahing here.

    Look who's talking...

    Anyway carp() seems to already do by default what I wanted. \o/

    It doesn't report from the caller function but the caller package.

    use strict; use warnings; use Data::Dump qw/pp dd/; TEST::first(); # <- line 6 #push @main::CARP_NOT, qw(TEST); # uncomment to see dynamic behaviour #TEST::first(); package TEST; use Carp; sub first { second(); } sub second { carp "some warning"; }

    some warning at d:/Users/RolfLangsdorf/pm/carp_not.pl line 6.

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-01-16 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (49 votes). Check out past polls.

    Notices?