Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

I never remember the Carp function names

by metaperl (Curate)
on Jul 13, 2011 at 17:09 UTC ( [id://914165]=perlmeditation: print w/replies, xml ) Need Help??

I wish I had aliases for these functions such as:
warn1 warnfull die1 diefull
for dying with 1-level or full backtrace. The names croak, confess, carp, and cluck have no rhyme or reason - just alliteration :)



The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"

Replies are listed 'Best First'.
Re: I never remember the Carp function names
by JavaFan (Canon) on Jul 13, 2011 at 22:32 UTC
    package Carpy; use strict; use warnings; use Carp (); sub import { my $caller = caller; no strict 'refs'; *{$caller . "::warn1"} = \&{"Carp::carp"}; *{$caller . "::warnfull"} = \&{"Carp::cluck"}; *{$caller . "::die1"} = \&{"Carp::croak"}; *{$caller . "::diefull"} = \&{"Carp::confess"}; } 1;
Re: I never remember the Carp function names
by ikegami (Patriarch) on Jul 13, 2011 at 17:15 UTC
    So write a module that provides those aliases
Re: I never remember the Carp function names
by jdporter (Paladin) on Jul 14, 2011 at 03:42 UTC

    You know what, metaperl? I think you rock, and I am so glad you're here. I'm glad you've stuck around all these years. You've taken a lot of crap, from time to time, and you always just let it roll off your back, with utmost grace. You are an exemplary monk.

    Carry on. :-)

    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Re: I never remember the Carp function names
by Anonymous Monk on Jul 14, 2011 at 00:45 UTC
    Or, consider using Carp::Always. Now all your die()'s and warn()'s produce backtraces. The Carp concept is kinda silly anyway, methinks.
      Could you elaborate about the silliness part?
Re: I never remember the Carp function names
by Anonymous Monk on Jul 14, 2011 at 12:11 UTC
    Stop carping, willya? Or would we say that you are clucking? ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://914165]
Approved by ikegami
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found