Conversation
This fixes Perl#18861 This rewords the 'print' entry as asked for by this ticket and its comments.
|
This is going to fail porting tests, because I did something unexpected in the synopsis. But I thought I'd get people's comments on the actual content of it. |
|
I don't think you referenced the right issue |
|
|
||
| We'll have more to say below about using braces for more complicated cases. | ||
|
|
||
| Without the braces, ambiguities are still possible. Consider |
There was a problem hiding this comment.
Even more ambiguous is when you print the return value of a function, like print foo; maybe useful to mention something like this as well.
| C<FILEHANDLE> may be a bareword, in which case it must be associated | ||
| with a file, pipe, or descriptor. That association is implicit for |
There was a problem hiding this comment.
"file, pipe, or descriptor" - I'm not sure what you mean by descriptor here in context. Also sockets, TTYs, and probably other writable devices that don't occur to me right now.
I think it could just be something like "... may be a bareword, which must be an open handle opened for output."
|
|
||
| C<FILEHANDLE> may be a bareword, in which case it must be associated | ||
| with a file, pipe, or descriptor. That association is implicit for | ||
| either of the barewords C<STDOUT> or C<STDERR>, or explicit by use of |
There was a problem hiding this comment.
STDOUT, STDERR and ARGVOUT. But I don't think describing all the possible handles belongs here.
| the previous paragraph, or itself have been used in an C<open> or | ||
| C<sysopen> call, and not have been closed in the meantime. | ||
|
|
||
| C<FH_EXPRESSION> is an expression that evaluates to a scalar value |
There was a problem hiding this comment.
This misses globs:
$ perl -e 'print {*STDOUT} "Hello\n"'
Hello
There was a problem hiding this comment.
In general I think the description of valid handles is overly prescriptive, eg. that the be a scalar variable .. itself have been used in C<open> or C<sysopen> call
Even adding socket, pipe, this sounds like you have to use the original variable, and that a copy isn't valid.
Similarly with barename
# FOO hasn't been passed to open, sysopen
$ perl -e '*FOO = *STDOUT; print FOO "Hello\n"'
Hello
Perhaps this should refer to perldata/Typeglobs and Filehandles
I suspect it's #18661 |
This fixes #18861
This rewords the 'print' entry as asked for by this ticket and its comments.