Clownfish::Err(3pm)

πŸ“¦
version 0.8.0 Β· 3 versions
, in fedora 43, fedora 44

✨ 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() and get_error() are the shared-variable accessors, and cat_mess / get_mess are the methods you actually call on your Err object. 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