1Check::ISA(3) User Contributed Perl Documentation Check::ISA(3)
2
3
4
6 Check::ISA - DWIM, correct checking of an object's class.
7
9 Version 0.09
10
12 use Check::ISA;
13
14 if (obj($foo, "SomeClass")) {
15 $foo->some_method;
16 }
17
18 # instead of one of these methods:
19 UNIVERSAL::isa($foo, "SomeClass") # WRONG
20 ref $obj eq "SomeClass"; # VERY WRONG
21 $foo->isa("SomeClass") # May die
22 local $@; eval { $foo->isa("SomeClass") } # too long
23
25 This module provides several functions to assist in testing whether a
26 value is an object, and if so asking about its class.
27
29 obj $thing, [ $class ]
30 This function tests if $thing is an object.
31
32 If $class is provided, it also tests tests whether
33 "$thing->isa($class)".
34
35 $thing is considered an object if it's blessed or a "GLOB" with a
36 valid "IO" slot (the "IO" slot contains a FileHandle object which
37 is the actual invocant). This corresponds directly to
38 "gv_fetchmethod".
39
40 obj_does $thing, [ $class_or_role ]
41 Just like "obj" but uses "DOES" in UNIVERSAL instead of "isa" in
42 UNIVERSAL.
43
44 "DOES" in UNIVERSAL is just like "isa" except it's use is
45 encouraged to query about an interface, as opposed to the object
46 structure. If "DOES" is not overridden by the ebject, calling it is
47 semantically identical to calling "isa".
48
49 This is probably reccomended over "obj" for interoperability but
50 can be slower on Perls before 5.10.
51
52 Note that "DOES" in UNIVERSAL
53
54 inv $thing, [ $class_or_role ]
55 Just like "obj_does", but also returns true for classes.
56
57 Note that this method is slower, but is supposed to return true for
58 any value you can call methods on (class, object, filehandle, etc).
59
60 Look into autobox if you would like to be able to call methods on
61 all values.
62
63 obj_can $thing, $method
64 inv_can $thing, $method
65 Checks if $thing is an object or class, and calls "can" on $thing
66 if appropriate.
67
69 UNIVERSAL, Params::Util, autobox, Moose, asa
70
72 <https://github.com/manwar/Check-ISA>
73
75 Please report any bugs or feature requests to "bug-check-isa at
76 rt.cpan.org", or through the web interface at
77 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Check-ISA>. I will be
78 notified and then you'll automatically be notified of progress on your
79 bug as I make changes.
80
82 You can find documentation for this module with the perldoc command.
83
84 perldoc Check::ISA
85
86 You can also look for information at:
87
88 • RT: CPAN's request tracker (report bugs here)
89
90 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Check-ISA>
91
92 • AnnoCPAN: Annotated CPAN documentation
93
94 <http://annocpan.org/dist/Check-ISA>
95
96 • CPAN Ratings
97
98 <http://cpanratings.perl.org/d/Check-ISA>
99
100 • Search CPAN
101
102 <http://search.cpan.org/dist/Check-ISA/>
103
105 Yuval Kogman <nothingmuch@woobling.org>
106
107 Currently maintained by Mohammad S Anwar (MANWAR), "<mohammad.anwar at
108 yahoo.com>"
109
111 Copyright (c) 2008 Yuval Kogman.
112
113 Copyright (c) 2016 Mohammad S Anwar.
114
115 All rights reserved. This program is free software; you can
116 redistribute it and / or modify it under the same terms as Perl itself.
117
118 Any use, modification, and distribution of the Standard or Modified
119 Versions is governed by this License. By using, modifying or
120 distributing the Package, you accept this license. Do not use, modify,
121 or distribute the Package, if you do not accept this license.
122
123 If your Modified Version has been derived from a Modified Version made
124 by someone other than you,you are nevertheless required to ensure that
125 your Modified Version
126 complies with the requirements of this license.
127
128 This license does not grant you the right to use any trademark,
129 service mark, tradename, or logo of the Copyright Holder.
130
131 This license includes the non-exclusive, worldwide, free-of-charge
132 patent license to make, have made, use, offer to sell, sell, import
133 and otherwise transfer the Package with respect to any patent claims
134 licensable by the Copyright Holder that are necessarily infringed by
135 the Package. If you institute patent litigation (including a cross-
136 claim or counterclaim) against any party alleging that the Package
137 constitutes direct or contributory patent infringement, then this
138 License to you shall terminate on the date that such litigation is
139 filed.
140
141 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT
142 HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED
143 WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
144 FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO
145 THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO
146 COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
147 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT
148 OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
149 DAMAGE.
150
151
152
153perl v5.32.1 2021-01-26 Check::ISA(3)