3 # UNIVERSAL should not contain any extra subs/methods beyond those
4 # that it exists to define. The use of Exporter below is a historical
5 # accident that should be fixed sometime.
7 *import = \&Exporter::import;
8 @EXPORT_OK = qw(isa can);
15 UNIVERSAL - base class for ALL classes (blessed references)
19 $io = $fd->isa("IO::Handle");
20 $sub = $obj->can('print');
22 $yes = UNIVERSAL::isa($ref, "HASH");
26 C<UNIVERSAL> is the base class which all bless references will inherit from,
29 C<UNIVERSAL> provides the following methods
35 C<isa> returns I<true> if C<REF> is blessed into package C<TYPE>
36 or inherits from package C<TYPE>.
38 C<isa> can be called as either a static or object method call.
42 C<can> checks if the object has a method called C<METHOD>. If it does
43 then a reference to the sub is returned. If it does not then I<undef>
46 C<can> can be called as either a static or object method call.
48 =item VERSION ( [ REQUIRE ] )
50 C<VERSION> will return the value of the variable C<$VERSION> in the
51 package the object is blessed into. If C<REQUIRE> is given then
52 it will do a comparison and die if the package version is not
53 greater than or equal to C<REQUIRE>.
55 C<VERSION> can be called as either a static or object method call.
59 The C<isa> and C<can> methods can also be called as subroutines
63 =item UNIVERSAL::isa ( VAL, TYPE )
65 C<isa> returns I<true> if the first argument is a reference and either
66 of the following statements is true.
72 C<VAL> is a blessed reference and is blessed into package C<TYPE>
73 or inherits from package C<TYPE>
77 C<VAL> is a reference to a C<TYPE> of perl variable (er 'HASH')
81 =item UNIVERSAL::can ( VAL, METHOD )
83 If C<VAL> is a blessed reference which has a method called C<METHOD>,
84 C<can> returns a reference to the subroutine. If C<VAL> is not
85 a blessed reference, or if it does not have a method C<METHOD>,
90 These subroutines should I<not> be imported via S<C<use UNIVERSAL qw(...)>>.
91 If you want simple local access to them you can do
93 *isa = \&UNIVERSAL::isa;
95 to import isa into your package.