This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [REPATCH] Re: [PATCH] Re: [ID 20011030.064] File::Temp tempdir(CLEANUP => 1)...
[perl5.git] / lib / UNIVERSAL.pm
index dc02423..a9cb478 100644 (file)
@@ -1,5 +1,7 @@
 package UNIVERSAL;
 
+our $VERSION = '1.00';
+
 # 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.
@@ -43,6 +45,15 @@ C<can> checks if the object has a method called C<METHOD>. If it does
 then a reference to the sub is returned. If it does not then I<undef>
 is returned.
 
+C<can> cannot know whether an object will be able to provide a method
+through AUTOLOAD, so a return value of I<undef> does not necessarily mean
+the object will not be able to handle the method call. To get around
+this some module authors use a forward declaration (see L<perlsub>)
+for methods they will handle via AUTOLOAD. For such 'dummy' subs, C<can>
+will still return a code reference, which, when called, will fall through
+to the AUTOLOAD. If no suitable AUTOLOAD is provided, calling the coderef
+will cause an error.
+
 C<can> can be called as either a static or object method call.
 
 =item VERSION ( [ REQUIRE ] )
@@ -62,19 +73,23 @@ The C<isa> and C<can> methods can also be called as subroutines
 
 =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