diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-12-06 19:58:51 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-12-06 19:58:51 +0000 |
commit | 085bcbb1d33da8a158e1316d85fae9d242baf2d0 (patch) | |
tree | 0c3d14869dc87233e5448bf72cd19b93904c1914 /pod/perldelta.pod | |
parent | 159b10bbeba7b6f29b26844c4a919e2a39f1feb6 (diff) | |
download | perl-085bcbb1d33da8a158e1316d85fae9d242baf2d0.tar.gz |
Remove the "Can't provide tied hash usage" error from perldiag.
Mention the new tied hash SCALAR method in perldelta.
p4raw-id: //depot/perl@21857
Diffstat (limited to 'pod/perldelta.pod')
-rw-r--r-- | pod/perldelta.pod | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index f8b5deaa86..9ebb2edb60 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -216,6 +216,22 @@ contains a package variable named C<$NEGATIVE_INDICES> which is set to a true value, negative values will be passed to C<FETCH>, C<STORE>, C<EXISTS>, and C<DELETE> unchanged. +=head2 Tied hashes in scalar context + +As of perl 5.8.2, tied hashes did not return anything useful in scalar +context, for example when used as boolean tests: + + if (%tied_hash) { ... } + +The old nonsensical behaviour was always to return false, +regardless of whether the hash is empty or has elements. + +There is now an interface for the implementors of tied hashes to implement +the behaviour of a hash in scalar context, via the SCALAR method (see +L<perltie>). Without a SCALAR method, perl will try to guess whether +the hash is empty, by testing if it's inside an iteration (in this case +it can't be empty) or by calling FIRSTKEY. + =head2 local ${$x} The syntaxes @@ -861,19 +877,6 @@ common Perl platforms (Unix and Unix-like, Microsoft platforms, and VMS) have large enough testing and expert population that they are doing well. -=head2 Tied hashes in scalar context - -Tied hashes do not currently return anything useful in scalar context, -for example when used as boolean tests: - - if (%tied_hash) { ... } - -The current nonsensical behaviour is always to return false, -regardless of whether the hash is empty or has elements. - -The root cause is that there is no interface for the implementors of -tied hashes to implement the behaviour of a hash in scalar context. - =head2 Net::Ping 450_service and 510_ping_udp failures The subtests 9 and 18 of lib/Net/Ping/t/450_service.t, and the |