UNIVERSAL::isa(3)
π UNIVERSAL::isa(3) β User Contributed Perl Documentation π
okay bestie, this is the manual page for UNIVERSAL::isa, from the User Contributed Perl Documentation section, and it is giving very niche Perl rescue mission. iykyk. π
πΈ NAME πΈ
UNIVERSAL::isa β attempt to recover from people calling UNIVERSAL::isa as a function. no cap, that is the whole quest. π
β¨ VERSION β¨
version 1.20171012. periodt. π
π¦ SYNOPSIS π¦
here is the vibe check, bestie:
# from the shell
echo 'export PERL5OPT=-MUNIVERSAL::isa' >> /etc/profile
# within your program
use UNIVERSAL::isa;
# enable warnings for all dodgy uses of UNIVERSAL::isa
use UNIVERSAL::isa 'verbose';
π DESCRIPTION π
Whenever you use isa in UNIVERSAL as a function, a kitten using Test::MockObject dies. π not me getting emotional over kittens, but that is literally the situation. Normally, the kittens would be helpless, but if they use UNIVERSAL::isa (the module whose docs you are reading), the kittens can live long and prosper. π±β¨
This module replaces UNIVERSAL::isa with a version that makes sure that, when called as a function on objects which override isa, isa will call the appropriate method on those objects. π«Ά
In all other cases, the real UNIVERSAL::isa gets called directly.
NOTE: You should use this module only for debugging purposes. It does not belong as a dependency in running code. π¨ fr fr, keep it out of production dependencies.
π§ FUNCTIONS π§
π original_isa π
This sub contains the definition of the original UNIVERSAL::isa definition, in case you need it. yes, definition-ception, but it is there for you. π
π₯ WARNINGS π₯
If the lexical warnings pragma is available, this module will emit a warning for each naughty invocation of UNIVERSAL::isa. Silence these warnings by saying:
no warnings 'UNIVERSAL::isa';
in the lexical scope of the naughty code. π
After version 1.00, warnings only appear when naughty code calls UNIVERSAL::isa() as a function on an invocant for which there is an overridden isa(). These are really truly active bugs, and you should fix them rather than relying on this module to find them. π©
To get warnings for all potentially dangerous uses of UNIVERSAL::isa() as a function, not a method (that is, for all uses of the method as a function, which are latent bugs, if not bugs that will break your code as it exists now), pass the verbose flag when using the module. This can generate many extra warnings, but they're more specific as to the actual wrong practice and they usually suggest proper fixes. π
π SEE ALSO π
Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsaUNIVERSAL::canfor another discussion of the problem at hand.Test::MockObjectfor one example of a module that really needs to overrideisa().- Any decent explanation of OO to understand why calling methods as functions is a staggeringly bad idea. π
π«Ά SUPPORT π«Ά
Bugs may be submitted through the RT bug tracker at https://rt.cpan.org/Public/Dist/Display.html?Name=UNIVERSAL-isa (or email bug-UNIVERSAL-isa@rt.cpan.org, aka mailto:bug-UNIVERSAL-isa@rt.cpan.org). ππ
π AUTHORS π
- Audrey Tang
cpan@audreyt.org - chromatic
chromatic@wgz.org - ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman)
nothingmuch@woobling.org
π CONTRIBUTORS π
- Karen Etheridge
ether@cpan.org - Graham Knop
haarg@haarg.org - Ricardo Signes
rjbs@cpan.org
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2011 by chromatic@wgz.org. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πΈ
mwah π cute little sign-off: this page comes from source/version perl v5.42.0, dated 2017-10-13. stay slay, bestie. π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-UNIVERSAL-isa 1.20171012-bp160.1.12 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms