diff options
author | Dominic Dunlop <domo@computer.org> | 2000-12-12 11:47:10 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-14 21:42:57 +0000 |
commit | 847c7ebe844d914694620789a161f1cb744b72d3 (patch) | |
tree | b6dcff952c3dbe2fec56a31455ba1116f506129e /pod | |
parent | 60cba15a811438a2d052d1c9747a334fc770974d (diff) | |
download | perl-847c7ebe844d914694620789a161f1cb744b72d3.tar.gz |
Re: [ID 20001013.006] XS subs are not define()ed
Message-Id: <p04320402b65ba33a92b2@[192.168.1.4]>
Document how elusive subroutines can be.
p4raw-id: //depot/perl@8112
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfunc.pod | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 06d3b1da2d..ed3f2dc6a3 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -923,7 +923,10 @@ element to return happens to be C<undef>. You may also use C<defined(&func)> to check whether subroutine C<&func> has ever been defined. The return value is unaffected by any forward -declarations of C<&foo>. +declarations of C<&foo>. Note that a subroutine which is not defined +may still be callable: its package may have an C<AUTOLOAD> method that +makes it spring into existence the first time that it is called -- see +L<perlsub>. Use of C<defined> on aggregates (hashes and arrays) is deprecated. It used to report whether memory for that aggregate has ever been @@ -1479,7 +1482,10 @@ it exists, but the reverse doesn't necessarily hold true. Given an expression that specifies the name of a subroutine, returns true if the specified subroutine has ever been declared, even if it is undefined. Mentioning a subroutine name for exists or defined -does not count as declaring it. +does not count as declaring it. Note that a subroutine which does not +exist may still be callable: its package may have an C<AUTOLOAD> +method that makes it spring into existence the first time that it is +called -- see L<perlsub>. print "Exists\n" if exists &subroutine; print "Defined\n" if defined &subroutine; |