Class::WhiteHole(3pm)
β¨ Class::WhiteHole β¨
okay bestie, sit down, because this little module is a whole vibe and honestly kind of iconic π it's a base class whose entire job is to make unhandled method calls scream at you instead of quietly doing something cursed. it's giving chaos-prevention. it's giving let the error be an error. π«Ά
perl people call this a manual page, which is just boomer for "the docs". let's get into it πΈ
π SYNOPSIS π
like, imagine you're building Bar:
package Bar;
# DBI inherits from DynaLoader which inherits from AutoLoader
# Bar wants to avoid this accidental inheritance of AutoLoader.
use base qw(Class::WhiteHole DBI);
see how Class::WhiteHole is chillin' at the front of that list? keep that energy. π
π DESCRIPTION π
so here's the tea β: sometimes you accidentally inherit an AUTOLOAD method and you did not consent to that. it usually happens when some class somewhere up the inheritance chain uses AutoLoader, or just defines one of its own for funsies. and then?? when a method lookup fails, you get the most confusing, unhinged error messages known to perl-kind. π it's literally the worst.
and sometimes β no cap β you just want to avoid that accidental inheritance entirely. that's the moment you inherit from Class::WhiteHole. π¦ every single unhandled method becomes a normal, honest-to-god Perl error message. no mystery AUTOLOAD gremlin lurking in the background. just clean errors. slay. β¨
π¨ BUGS & CAVEATS π¨
listen, this part is important, don't skip it π
- be sure to put
Class::WhiteHolebefore the class you're inheritingAUTOLOADfrom in theISA. usually you wantClass::WhiteHoleto come first. order matters, bestie, it's a whole thing. - if your class inherits autoloaded routines, this class may cause them to stop working. so likeβ¦ choose wisely before using. this is your warning. β οΈ
White holesare only a hypothesis and may not really exist. π (yes really, that's in the docs. the astrophysics is not peer-reviewed. it's giving theoretical.)
fr fr: white holes = unconfirmed. your method calls = very much confirmed. don't mix them up.
π COPYRIGHT π
Copyright 2000 Michael G Schwern <schwern@pobox.com> all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π AUTHOR π
Michael G Schwern <schwern@pobox.com>
π SEE ALSO π
Class::BlackHoleβ the other one. the brooding sibling. π€
that's the whole page, you ate it π
this came out of the perl v5.36.0 docs, dated 2022-10-13, under the "User Contributed Perl Documentation" umbrella β so go forth, put Class::WhiteHole first in your ISA, and let your errors be loud and your inheritance be intentional. periodt. ππβ¨
π¦ where this page comes from
- ubuntu noble: libclass-whitehole-perl 0.04-9 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-whitehole-perl 0.04-9 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-whitehole-perl 0.04-9 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms