diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-04 01:00:49 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-04 01:00:49 +0000 |
commit | 2c8ac474a00b933b4d84e8567b4b6db1293ad0ef (patch) | |
tree | e6aae0baa7006e94a6f49152182180b0cd4a5948 /pod | |
parent | 951ba7fe8dad4074b389cb34ee7e8b446c17c0fb (diff) | |
download | perl-2c8ac474a00b933b4d84e8567b4b6db1293ad0ef.tar.gz |
better implementation of change#3326; open(local $foo,...) now
allowed in addition to any uninitialized variable, for consistency
with how autovivification works elsewhere; add code to use the
variable name as the name of the handle for simple variables, so
that diagnostics report the handle: "... at - line 1, <$foo> line 10."
p4raw-link: @3326 on //depot/perl: 853846ea710f8feaed8c98b358bdc8967dd522d2
p4raw-id: //depot/perl@4639
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldelta.pod | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 12d26841a1..47a9eb13c5 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -360,11 +360,14 @@ The length argument of C<syswrite()> has become optional. =head2 Filehandles can be autovivified -The construct C<open(my $fh, ...)> can be used to create filehandles -more easily. The filehandle will be automatically closed at the end -of the scope of $fh, provided there are no other references to it. This -largely eliminates the need for typeglobs when opening filehandles -that must be passed around, as in the following example: +Similar to how constructs such as C<$x->[0]> autovivify a reference, +open() now autovivifies a filehandle if the first argument is an +uninitialized variable. This allows the constructs C<open(my $fh, ...)> and +C<open(local $fh,...)> to be used to create filehandles that will +conveniently be closed automatically when the scope ends, provided there +are no other references to them. This largely eliminates the need for +typeglobs when opening filehandles that must be passed around, as in the +following example: sub myopen { open my $fh, "@_" |