Clownfish::Err(3pm)
β¨ Clownfish::Err β¨
ok so bestie, welcome to the Clownfish::Err(3pm) page π this is the manual for the Clownfish::Err module, and it's genuinely so much more chill than it sounds. come sit with me.
πΈ NAME πΈ
Clownfish::Err β Exception. periodt.
π SYNOPSIS π
like, here's the whole vibe in code:
package MyErr;
use base qw( Clownfish::Err );
...
package main;
use Scalar::Util qw( blessed );
while (1) {
eval {
do_stuff() or MyErr->throw("retry");
};
if ( blessed($@) and $@->isa("MyErr") ) {
warn "Retrying...\n";
}
else {
# Re-throw.
die "do_stuff() died: $@";
}
}
no cap, this is the classic retry-loop moment π
π¦ DESCRIPTION π¦
okay so Clownfish::Err is the base class for exceptions in the Clownfish object hierarchy. main character energy, fr fr. every exception in that whole family lowkey owes its whole existence to this module.
and here's the part that's giving β¨bonus featureβ¨ β the Err module also gives you access to a per-thread Err shared variable via set_error() and get_error(). you can use it to stash an Err object in there temporarily, so that the calling code gets to decide how it wants to handle a particular error condition. it's like a lil locker for your error, iykyk π«Ά
π METHODS π
π cat_mess
$err->cat_mess($mess);
concatenate the supplied argument onto the error message. that's it, that's the whole thing β you're literally just sticking $mess onto the end of the error message. ate. π
π§ get_mess
my $string = $err->get_mess();
return the error message. simple as, bestie. πΈ
π INHERITANCE π
Clownfish::Err isa Clownfish::Obj. it's literally right there in the family tree, no mystery. π
ok so quick reminder bestie:set_error()andget_error()are the shared-variable accessors, andcat_mess/get_messare the methods you actually call on yourErrobject. don't mix 'em up π
and that's the whole page!! ππ¦β no notes, iconic, we love a tiny module that does exactly one thing and does it well.
this fine piece of documentation shipped as part of perl v5.42.3, dated 2026-09-02 β so like, go forth and throw exceptions responsibly ππ«Άβ¨
π¦ where this page comes from
- fedora 43: perl-Clownfish 0.8.0-1.fc43 Β· Apache-2.0
- fedora 44: perl-Clownfish 0.8.0-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms