develooper Front page | perl.perl5.porters | Postings from January 2019

[perl #121033] [PATCH] Document read/write-only undef open

From:
Tony Cook via RT
Date:
January 2, 2019 05:02
Subject:
[perl #121033] [PATCH] Document read/write-only undef open
Message ID:
rt-4.0.24-31786-1546405348-1324.121033-15-0@perl.org
On Thu, 23 Jan 2014 04:28:39 -0800, tobyink wrote:
> How about this text?
> 
> """
> As a special case the three-argument form with the third argument
> being C<undef>:
> 
> open(my $tmp, "+>", undef) or die ...
> 
> opens a filehandle to an anonymous temporary file. An anonymous file
> can be opened in any mode, but opening it in read-write mode is likely
> to be the most useful. (If the file is open in read-write mode, you
> can write to it, then C<seek()> to the beginning of the file, and read
> back from it.)
> """


32458de9a4322bd2e66c525d33720a42df7e0b56 introduced something similar to this:

This now reads:

As a special case the three-argument form with a read/write mode and the third
argument being L<C<undef>|/undef EXPR>:

    open(my $tmp, "+>", undef) or die ...

opens a filehandle to a newly created empty anonymous temporary file.
(This happens under any mode, which makes C<< +> >> the only useful and
sensible mode to use.)  You will need to
L<C<seek>|/seek FILEHANDLE,POSITION,WHENCE> to do the reading.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=121033



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About