1UNIVERSAL::isa(3) User Contributed Perl Documentation UNIVERSAL::isa(3)
2
3
4
6 UNIVERSAL::isa - Attempt to recover from people calling UNIVERSAL::isa
7 as a function
8
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
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
32 If the lexical warnings pragma is available, this module will emit a
33 warning for each naughty invocation of "UNIVERSAL::isa". Silence these
34 warnings by saying:
35
36 no warnings 'UNIVERSAL::isa';
37
38 in the lexical scope of the naughty code.
39
40 After version 1.00, warnings only appear when naughty code calls
41 UNIVERSAL::isa() as a function on an invocant for which there is an
42 overridden isa(). These are really truly active bugs, and you should
43 fix them rather than relying on this module to find them.
44
45 To get warnings for all potentially dangerous uses of UNIVERSAL::isa()
46 as a function, not a method (that is, for all uses of the method as a
47 function, which are latent bugs, if not bugs that will break your code
48 as it exists now), pass the "verbose" flag when using the module. This
49 can generate many extra warnings, but they're more specific as to the
50 actual wrong practice and they usually suggest proper fixes.
51
53 UNIVERSAL::can for another discussion of the problem at hand.
54
55 Test::MockObject for one example of a module that really needs to
56 override "isa()".
57
58 Any decent explanation of OO to understand why calling methods as
59 functions is a staggeringly bad idea.
60
62 Audrey Tang <cpan@audreyt.org>
63
64 chromatic <chromatic@wgz.org>
65
66 Yuval Kogman <nothingmuch@woobling.org>
67
69 Artistic Licence 2.0, (c) 2005 - 2009.
70
71
72
73perl v5.12.0 2010-05-07 UNIVERSAL::isa(3)