I did not use Carp so much because I generally rolled on my own. However, in the spirit of complying with the Core modules, I am using it now. However, it seems that this is hardly better than warning / dying.
Also, what does cluck / confess / verbose even do? I ran this short script to figure out what the output looks like (because Carp docs don't do this). It looks exactly the same on any run (besides random strings).
#!/usr/bin/perl package Warning; sub warning { warn "warn"; } package CWarn; use Carp qw(carp cluck); sub cwarn { int(rand(2)) ? carp "carp" : cluck "cluck"; } package Fatal; use Carp qw(confess croak); sub fatal { int(rand(2)) ? confess "confess" : croak "croak"; } package Loop; use v5.10; sub loop { say '=' x 80; Warning::warning(); CWarn::cwarn(); loop() unless ($c++ > 10); Fatal::fatal(); } package main; Warning::warning(); CWarn::cwarn(); Loop::loop();
UPDATE: Updated script with package names, and that makes a difference. However, Carp still seems very simple in terms of registration information, and it does not support web-based logout. I think I'll look at others like CGI :: Carp, Log :: Output and Log :: Log4Perl.
perl error-handling carp
Brendan Byrd 01 Oct 2018-11-11T00: 00Z
source share