Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: carp always showing stacktrace

by siberia-man (Friar)
on Jul 21, 2020 at 12:07 UTC ( [id://11119591]=note: print w/replies, xml ) Need Help??


in reply to carp always showing stacktrace

By this link I've found the answer how to distinguish difference among these functions: What's the difference between Carp/Croak, Cluck/Confess, and verbose options?. Unfortunately there are no any mnemonic rules to memorize their usage.

Too hard to foresee meanings of these four C-words, when they express something very similar each other. I understand that using them makes Perl lexicon richer even more poetical, but logic is definitely lost.
warn - carp (critisize) - cluck (sound like a chicken) die - croak (sound like a frog) - confess (recognize about sin)
Just for lulz. cluck looks like Russian клац (meaning something similar to click-clack a weapon). Croak is pronounced closer to кряк, which means in Russian to sound like a goose. In the other hand, quack is pronounced exactly like croak in Russian.

Replies are listed 'Best First'.
Re^2: carp always showing stacktrace
by Your Mother (Archbishop) on Jul 21, 2020 at 14:08 UTC

    I personally find the names intuitive but the meanings are idiomatic and perhaps overly cute/clever for non-native speakers. Cluck also means to “wag one’s tongue.” Croak is also to die; even used as a verb to kill. Confess is to explain a sin at length or in detail. Alliteration is a kind of mnemonic.

    Update, typo corrected via hippo. Life imitates me imitating life -> :P s/tonue/tongue/;

Re^2: carp always showing stacktrace
by LanX (Saint) on Jul 21, 2020 at 12:37 UTC
    Thanks for the SO-link ...

    I totally agree with you that this naming is unfortunate.

    To the point that I can't read my own modules w/o comments.

    Now I'm pondering about aliasing them in my own modules, to help me understand my code

    expanding the text from SO with potential aliases.

    There are 2 sets of yes/no options. The function can be fatal (like die) or nonfatal (like warn). It can report just the line where the function was called, or it can report a full backtrace.

    Fatal Backtrace Alias carp N N warn_user ° cluck N Y warn_full croak Y N die_user confess Y Y die_full

    FWIW: Renaming subs is easy in Perl.

    *warn_user = \&Carp::carp

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

    °) it's not warning the caller

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-25 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found