CPANPLUS::Error(3pm)

πŸ“¦
version 0.9916 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– CPANPLUS::Error β€” error handling for CPANPLUS πŸ’–

okay bestie, welcome to the manual page for CPANPLUS::Error (3pm) β€” yes she's a Perl module, yes she's from the User Contributed Perl Documentation era, and yes she's lowkey carrying the entire CPANPLUS emotional support system. sit down, grab a strawberry, let's get into it πŸ“βœ¨


✨ SYNOPSIS ✨

the whole vibe, in one line:

use CPANPLUS::Error qw[cp_msg cp_error];

that's it. that's the entry point. iconic behavior honestly πŸ‘‘


🌸 DESCRIPTION 🌸

so basically? this module is the error handling code for all the CPANPLUS libraries. she's the one catching feelings β€” sorry, catching errors β€” behind the scenes.

fr fr though: this is mainly intended for internal use. she's not out here begging for attention, she's just doing her job in the background like the main character she is. πŸ’…


πŸ¦‹ FUNCTIONS πŸ¦‹

πŸ’œ cp_msg("message string" [,VERBOSE])

records a message on the stack πŸ“ β€” and if the VERBOSE option is true, she also prints it to STDOUT (or, actually, to $MSG_FH β€” peep the GLOBAL VARIABLES section below, iykyk).

heads up: VERBOSE defaults to false. so by default she's silent. mysterious. respectful of your terminal space. ✨

πŸ’œ msg()

just an alias for cp_msg. same girl, shorter name. 🫢

πŸ’œ cp_error("error string" [,VERBOSE])

records an error on the stack 😭 and, if VERBOSE is true, prints it to STDERR (or actually to $ERROR_FH β€” again, see the GLOBAL VARIABLES sections below).

and here's the plot twist: VERBOSE defaults to true for this one. errors wanna be SEEN. errors wanna be HEARD. errors are not shy. πŸ’€

πŸ’œ error()

an alias for cp_error. twin energy. 🌈


πŸ‘‘ CLASS METHODS πŸ‘‘

⭐ CPANPLUS::Error->stack()

retrieves all the items on the stack. since CPANPLUS::Error is implemented using Log::Message, you gotta consult its manpage for the function retrieve to see what actually gets returned and how to use the items. no gatekeeping, just go read it bestie πŸ“š

⭐ CPANPLUS::Error->stack_as_string([TRACE])

returns the whole stack as a printable string πŸŽ€. if the TRACE option is true, all the items come back with Carp::longmess output rather than just the message β€” like, full receipts, full lore, full context.

TRACE defaults to false. keep it chill by default. 🌸

⭐ CPANPLUS::Error->flush()

removes all the items from the stack and returns them. clean slate, fresh start, new era πŸ’…. and yep β€” since CPANPLUS::Error is implemented using Log::Message, consult its manpage for the function retrieve to see what is returned and how to use the items. same deal as stack(), different energy.


🌈 GLOBAL VARIABLES 🌈

  • $ERROR_FH β€” this is the filehandle that all the messages sent to error() get printed to. defaults to *STDERR. 🚨
  • $MSG_FH β€” this is the filehandle that all the messages sent to msg() get printed to. defaults to *STDOUT. πŸ’¬

🧚 a lil sign-off 🧚

and that's the whole page, bestie!! this one came from perl v5.40.1, dated 2025-03-01, and it's filed under CPANPLUS::Error(3pm). go forth and handle your errors with grace, drama, and impeccable filehandle choices. periodt πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from