1UNIVERSAL::isa(3)     User Contributed Perl Documentation    UNIVERSAL::isa(3)
2
3
4

NAME

6       UNIVERSAL::isa - Attempt to recover from people calling UNIVERSAL::isa
7       as a function
8

VERSION

10       version 1.20171012
11

SYNOPSIS

13           # from the shell
14           echo 'export PERL5OPT=-MUNIVERSAL::isa' >> /etc/profile
15
16           # within your program
17           use UNIVERSAL::isa;
18
19           # enable warnings for all dodgy uses of UNIVERSAL::isa
20           use UNIVERSAL::isa 'verbose';
21

DESCRIPTION

23       Whenever you use "isa" in UNIVERSAL as a function, a kitten using
24       Test::MockObject dies. Normally, the kittens would be helpless, but if
25       they use UNIVERSAL::isa (the module whose docs you are reading), the
26       kittens can live long and prosper.
27
28       This module replaces "UNIVERSAL::isa" with a version that makes sure
29       that, when called as a function on objects which override "isa", "isa"
30       will call the appropriate method on those objects
31
32       In all other cases, the real "UNIVERSAL::isa" gets called directly.
33
34       NOTE: You should use this module only for debugging purposes. It does
35       not belong as a dependency in running code.
36

FUNCTIONS

38   original_isa
39       This sub contains the definition of the original "UNIVERSAL::isa"
40       definition, in case you need it.
41

WARNINGS

43       If the lexical warnings pragma is available, this module will emit a
44       warning for each naughty invocation of "UNIVERSAL::isa". Silence these
45       warnings by saying:
46
47           no warnings 'UNIVERSAL::isa';
48
49       in the lexical scope of the naughty code.
50
51       After version 1.00, warnings only appear when naughty code calls
52       UNIVERSAL::isa() as a function on an invocant for which there is an
53       overridden isa().  These are really truly active bugs, and you should
54       fix them rather than relying on this module to find them.
55
56       To get warnings for all potentially dangerous uses of UNIVERSAL::isa()
57       as a function, not a method (that is, for all uses of the method as a
58       function, which are latent bugs, if not bugs that will break your code
59       as it exists now), pass the "verbose" flag when using the module.  This
60       can generate many extra warnings, but they're more specific as to the
61       actual wrong practice and they usually suggest proper fixes.
62

SEE ALSO

64       Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa
65
66       UNIVERSAL::can for another discussion of the problem at hand.
67
68       Test::MockObject for one example of a module that really needs to
69       override "isa()".
70
71       Any decent explanation of OO to understand why calling methods as
72       functions is a staggeringly bad idea.
73

SUPPORT

75       Bugs may be submitted through the RT bug tracker
76       <https://rt.cpan.org/Public/Dist/Display.html?Name=UNIVERSAL-isa> (or
77       bug-UNIVERSAL-isa@rt.cpan.org <mailto:bug-UNIVERSAL-isa@rt.cpan.org>).
78

AUTHORS

80       •   Audrey Tang <cpan@audreyt.org>
81
82       •   chromatic <chromatic@wgz.org>
83
84       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
85

CONTRIBUTORS

87       •   Karen Etheridge <ether@cpan.org>
88
89       •   Graham Knop <haarg@haarg.org>
90
91       •   Ricardo Signes <rjbs@cpan.org>
92
94       This software is copyright (c) 2011 by chromatic@wgz.org.
95
96       This is free software; you can redistribute it and/or modify it under
97       the same terms as the Perl 5 programming language system itself.
98
99
100
101perl v5.32.1                      2021-01-27                 UNIVERSAL::isa(3)
Impressum