PPI::Exception(3)

πŸ’– PPI::Exception β€” the PPI exception base class πŸ’–

okay bestie, so this is PPI::Exception, from the User Contributed Perl Documentation section of the manual. it's giving "foundation of every single crash-out in PPI" energy and honestly? iconic. πŸŽ€


✨ SYNOPSIS ✨

use PPI::Exception;

my $e = PPI::Exception->new( 'something happened' );
$e->throw;

PPI::Exception->new( message => 'something happened' )->throw;
PPI::Exception->throw( message => 'something happened' );

like, look at her go. three whole ways to say "something happened" and then yeet. πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea, fr fr: every single exception that gets thrown from inside PPI is an instance of this class, or of something derived from it. that's the whole vibe. this is the mother of all PPI exceptions and she knows it. πŸ‘‘


πŸ¦‹ METHODS πŸ¦‹

πŸ“ new $message | message => $message, ...

constructs and returns a shiny new PPI::Exception object. ✨

you can pass a message for the exception, and you've got options bestie β€” either just hand over a plain string, or do the fancy keyed thing with message => $message. either way that message is sitting there waiting for you, and you can grab it later with the message method. πŸ’œ


πŸ’€ throw

okay so this one's the main character. if you call throw on an actual PPI::Exception object, it throws that object. if you call it on the class name instead, it takes your arguments, builds a PPI::Exception out of them, and then throws that. same energy, different doorway. πŸšͺ✨

and here's the detail you do NOT wanna miss: every single time the object gets thrown, info from the Perl <caller(0)> call gets saved and made available through the callers method. so the receipts? always kept. πŸ“

⚠️ this method never returns. like, not "usually doesn't", not "sometimes doesn't" β€” never. it's gone. it threw hands and left. don't write code that expects to come back from this, bestie, because you will not. 😭

πŸŽ€ message

returns the exception message that got passed to the object's constructor. and if you didn't pass one? no worries, you get a default message instead. the fallback is real and it's there for you. 🫢


🌈 callers

returns a listref. every element inside that listref is itself a listref of caller(0) information. πŸ“š

and lowkey important: the returned listref can be empty. so don't just assume there's stuff in there β€” vibe check your listref first, okay? πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

hmm, actually there's no SEE ALSO section in this one, bestie β€” it's a short and sweet queen. πŸ’…


so yeah, that's PPI::Exception in full. 🧚 no cap, every exception PPI throws descends from her, she remembers her callers, and her throw is a one-way trip. slay. πŸ”₯

this page came from perl v5.42.0, dated 2026-01-17, and it's filed under PPI::Exception(3) in the User Contributed Perl Documentation. take care of her, she's the blueprint. πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from