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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

WARNINGS

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

SEE ALSO

56       Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa
57
58       UNIVERSAL::can for another discussion of the problem at hand.
59
60       Test::MockObject for one example of a module that really needs to
61       override "isa()".
62
63       Any decent explanation of OO to understand why calling methods as
64       functions is a staggeringly bad idea.
65

AUTHORS

67       Audrey Tang <cpan@audreyt.org>
68
69       chromatic <chromatic@wgz.org>
70
71       Yuval Kogman <nothingmuch@woobling.org>
72
74       Copyright (c) 2005 - 2011, chromatic. This module is made available
75       under the same terms as Perl 5.12.
76
77
78
79perl v5.16.3                      2014-06-09                 UNIVERSAL::isa(3)
Impressum