Change 11751 by ams@ams-lustre on 2001/08/25 18:28:43

        Subject: Re: 'can' with undefined subs
        From: Tony Bowden <[EMAIL PROTECTED]>
        Date: Sat, 25 Aug 2001 15:13:14 +0100
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/lib/UNIVERSAL.pm#10 edit

Differences ...

==== //depot/perl/lib/UNIVERSAL.pm#10 (text) ====
Index: perl/lib/UNIVERSAL.pm
--- perl/lib/UNIVERSAL.pm.~1~   Sat Aug 25 12:45:05 2001
+++ perl/lib/UNIVERSAL.pm       Sat Aug 25 12:45:05 2001
@@ -45,6 +45,15 @@
 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 ] )
End of Patch.

Reply via email to