summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorMark-Jason Dominus <mjd@plover.com>1999-05-27 12:05:44 -0400
committerJarkko Hietaniemi <jhi@iki.fi>1999-05-28 16:53:04 +0000
commit697943021785eb8447e25eb51a6f27fd78921863 (patch)
treeff410b34951b3231735fd69c7969267fe684fde3 /pod
parentd6a255e6be67358d1e8a71b939edbfc895ee4fa6 (diff)
downloadperl-697943021785eb8447e25eb51a6f27fd78921863.tar.gz
PATCH (5.005_57): defined(@a) now deprecated
To: perl5-porters@perl.com Message-ID: <19990527200544.13330.qmail@plover.com> p4raw-id: //depot/cfgperl@3498
Diffstat (limited to 'pod')
-rw-r--r--pod/perldelta.pod12
-rw-r--r--pod/perldiag.pod12
-rw-r--r--pod/perlfunc.pod18
3 files changed, 28 insertions, 14 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 7d8c0cc607..06346a645b 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -473,6 +473,18 @@ by Perl.
(W) You used the C<open(FH, "| command")> or C<open(FH, "command |")>
construction, but the command was missing or blank.
+=item defined(@array) is deprecated (and not really meaningful)
+
+(D) defined() is not usually useful on arrays because it checks for an
+undefined I<scalar> value. If you want to see if the array is empty,
+just use C<if (@array) { # not empty }> for example.
+
+=item defined(%hash) is deprecated (and not really meaningful)
+
+(D) defined() is not usually useful on hashes because it checks for an
+undefined I<scalar> value. If you want to see if the hash is empty,
+just use C<if (%hash) { # not empty }> for example.
+
=head1 Obsolete Diagnostics
Todo.
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 688e847085..0084f9c6da 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1105,6 +1105,18 @@ times more than it has returned. This probably indicates an infinite
recursion, unless you're writing strange benchmark programs, in which
case it indicates something else.
+=item defined(@array) is deprecated (and not really meaningful)
+
+(D) defined() is not usually useful on arrays because it checks for an
+undefined I<scalar> value. If you want to see if the array is empty,
+just use C<if (@array) { # not empty }> for example.
+
+=item defined(%hash) is deprecated (and not really meaningful)
+
+(D) defined() is not usually useful on hashes because it checks for an
+undefined I<scalar> value. If you want to see if the hash is empty,
+just use C<if (%hash) { # not empty }> for example.
+
=item Delimiter for here document is too long
(F) In a here document construct like C<E<lt>E<lt>FOO>, the label
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index ed3de62a23..4043301a5e 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -912,24 +912,14 @@ should use C<defined> only when you're questioning the integrity of what
you're trying to do. At other times, a simple comparison to C<0> or C<""> is
what you want.
-Currently, using C<defined> on an entire array or hash reports whether
-memory for that aggregate has ever been allocated. So an array you set
-to the empty list appears undefined initially, and one that once was full
-and that you then set to the empty list still appears defined. You
-should instead use a simple test for size:
+Use of C<defined> on aggregates (hashes and arrays) is deprecated. It
+used to report whether memory for that aggregate has ever been
+allocated. This behavior may disappear in future versions of Perl.
+You should instead use a simple test for size:
if (@an_array) { print "has array elements\n" }
if (%a_hash) { print "has hash members\n" }
-Using C<undef> on these, however, does clear their memory and then report
-them as not defined anymore, but you shouldn't do that unless you don't
-plan to use them again, because it saves time when you load them up
-again to have memory already ready to be filled. The normal way to
-free up space used by an aggregate is to assign the empty list.
-
-This counterintuitive behavior of C<defined> on aggregates may be
-changed, fixed, or broken in a future release of Perl.
-
See also L</undef>, L</exists>, L</ref>.
=item delete EXPR