[О блоге]
[наверх]
[пред]
[2025-05-16 22:07:32+03:00]
[c7175d0b155580e8422054b5175c8d6e71b8b1d9]
Темы: [fun][perl]
die, croak, carp, confess and *mess
В Perl я знал и использовал функцию die() постоянно, типа как exception
выкидывал ею. Но вот в Perl Best Practices рекомендуют croak. Люблю я
когда с юмором подходят к разработке и именованию.
NAME
Carp - alternative warn and die for modules
SYNOPSIS
use Carp;
# warn user (from perspective of caller)
carp "string trimmed to 80 chars";
# die of errors (from perspective of caller)
croak "We're outta here!";
# die of errors with stack backtrace
confess "not implemented";
# cluck, longmess and shortmess not exported by default
use Carp qw(cluck longmess shortmess);
cluck "This is how we got here!"; # warn with stack backtrace
$long_message = longmess( "message from cluck() or confess()" );
$short_message = shortmess( "message from carp() or croak()" );
[оставить комментарий]