diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-21 01:35:46 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-21 01:35:46 +0000 |
commit | b1a9ed4a50dbd0c26cd6f3422bdf7a12d75292f7 (patch) | |
tree | ba6ce095a529ee7a7f19b4ae2dfe2712f29fa866 | |
parent | daf405146fecd73a69819f299d586c6f14098385 (diff) | |
download | perl-b1a9ed4a50dbd0c26cd6f3422bdf7a12d75292f7.tar.gz |
mention the fact that open(my $foo, ...) covers all handle
constructors
p4raw-id: //depot/perl@4826
-rw-r--r-- | pod/perldelta.pod | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 9c040ed835..15b60ba0db 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -447,16 +447,17 @@ See L<perlfunc/exists> and L<perlfunc/delete> for examples. The length argument of C<syswrite()> has become optional. -=head2 Filehandles can be autovivified +=head2 File and directory handles can be autovivified 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: +handle constructors (open(), opendir(), pipe(), socketpair(), sysopen(), +socket(), and accept()) now autovivify a file or directory handle +if the handle passed to them is an uninitialized scalar variable. This +allows the constructs such as 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, "@_" |