Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Should I use carp/croak or warn/die

by jeffenstein (Friar)
on May 30, 2018 at 17:43 UTC ( #1215487=note: print w/replies, xml ) Need Help??


in reply to Re^3: Should I use carp/croak or warn/die
in thread Should I use carp/croak or warn/die

I can only guess why Larry & Co. did it this way, and that guess would be that it was to preserve backwards-compatibility with perl 4, which already had the current interface for warn and die.

Did caller exist in perl 4? It kind of makes sense to use a different interface since modules got a lot of changes in 5.0

  • Comment on Re^4: Should I use carp/croak or warn/die

Replies are listed 'Best First'.
Re^5: Should I use carp/croak or warn/die
by afoken (Canon) on May 30, 2018 at 21:52 UTC
    Did caller exist in perl 4?

    According to http://www.rexswain.com/perl4.html, caller existed in Perl 4, and so did die and warn.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^5: Should I use carp/croak or warn/die (perl4)
by shmem (Chancellor) on May 31, 2018 at 00:04 UTC

    From the perl.n manpage of perl 4 patchlevel 36:

    caller(EXPR)

    caller Returns the context of the current subroutine call:
    ($package,$filename,$line) = caller;
    With EXPR, returns some extra information that the debugger uses to print a stack trace. The value of EXPR indicates how many call frames to go back before the current one.
    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2020-11-24 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?