12 Oct 2017 05:36:14 UTC
- Distribution: UNIVERSAL-isa
- Module version: 1.20171012
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (3)
- Testers (7239 / 1 / 0)
- KwaliteeBus factor: 4
- 96.64% Coverage
- License: perl_5
- Perl: v5.6.2
- Activity24 month
- Download (28.66KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:2 non-PAUSE usersETHER Karen Etheridge 🐾 🌋🦑🇹🇼🇭🇰
- SEE ALSO
- COPYRIGHT AND LICENCE
UNIVERSAL::isa - Attempt to recover from people calling UNIVERSAL::isa as a function
# 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';
Whenever you use "isa" in UNIVERSAL as a function, a kitten using Test::MockObject dies. 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::isawith a version that makes sure that, when called as a function on objects which override
isawill call the appropriate method on those objects
In all other cases, the real
UNIVERSAL::isagets called directly.
NOTE: You should use this module only for debugging purposes. It does not belong as a dependency in running code.
This sub contains the definition of the original
UNIVERSAL::isadefinition, in case you need it.
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
verboseflag 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.
UNIVERSAL::can for another discussion of the problem at hand.
Test::MockObject for one example of a module that really needs to override
Any decent explanation of OO to understand why calling methods as functions is a staggeringly bad idea.
Audrey Tang <firstname.lastname@example.org>
יובל קוג'מן (Yuval Kogman) <email@example.com>
Karen Etheridge <firstname.lastname@example.org>
Graham Knop <email@example.com>
Ricardo Signes <firstname.lastname@example.org>
This software is copyright (c) 2011 by email@example.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install UNIVERSAL::isa, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install UNIVERSAL::isa
For more information on module installation, please visit the detailed CPAN module installation guide.