Use Errno magic.
[p5sagit/p5-mst-13.2.git] / lib / UNIVERSAL.pm
index 6d832c4..f2f1fe9 100644 (file)
@@ -1,7 +1,10 @@
 package UNIVERSAL;
 
+# UNIVERSAL should not contain any extra subs/methods beyond those
+# that it exists to define. The use of Exporter below is a historical
+# accident that should be fixed sometime.
 require Exporter;
-@ISA = qw(Exporter);
+*import = \&Exporter::import;
 @EXPORT_OK = qw(isa can);
 
 1;
@@ -13,12 +16,11 @@ UNIVERSAL - base class for ALL classes (blessed references)
 
 =head1 SYNOPSIS
 
-    use UNIVERSAL qw(isa);
-
-    $yes = isa($ref, "HASH");
     $io = $fd->isa("IO::Handle");
     $sub = $obj->can('print');
 
+    $yes = UNIVERSAL::isa($ref, "HASH");
+
 =head1 DESCRIPTION
 
 C<UNIVERSAL> is the base class which all bless references will inherit from,
@@ -54,29 +56,33 @@ C<VERSION> can be called as either a static or object method call.
 
 =back
 
-C<UNIVERSAL> also optionally exports the following subroutines
+The C<isa> and C<can> methods can also be called as subroutines
 
 =over 4
 
-=item isa ( VAL, TYPE )
+=item UNIVERSAL::isa ( VAL, TYPE )
 
-C<isa> returns I<true> if the first argument is a reference and either
-of the following statements is true.
+C<isa> returns I<true> if one of the following statements is true.
 
 =over 8
 
-=item
+=item *
+
+C<VAL> is a reference blessed into either package C<TYPE> or a package
+which inherits from package C<TYPE>.
+
+=item *
 
-C<VAL> is a blessed reference and is blessed into package C<TYPE>
-or inherits from package C<TYPE>
+C<VAL> is a reference to a C<TYPE> of Perl variable (e.g. 'HASH').
 
-=item
+=item *
 
-C<VAL> is a reference to a C<TYPE> of perl variable (er 'HASH')
+C<VAL> is the name of a package that inherits from (or is itself)
+package C<TYPE>.
 
 =back
 
-=item can ( VAL, METHOD )
+=item UNIVERSAL::can ( VAL, METHOD )
 
 If C<VAL> is a blessed reference which has a method called C<METHOD>,
 C<can> returns a reference to the subroutine.   If C<VAL> is not
@@ -85,4 +91,11 @@ I<undef> is returned.
 
 =back
 
+These subroutines should I<not> be imported via S<C<use UNIVERSAL qw(...)>>.
+If you want simple local access to them you can do
+
+  *isa = \&UNIVERSAL::isa;
+
+to import isa into your package.
+
 =cut