method eof
Documentation for method eof
assembled from the following types:
class IO::CatHandle
From IO::CatHandle
(IO::CatHandle) method eof
Defined as:
method eof(IO::CatHandle: --> Bool)
Returns True
if the read operations have exhausted the source handle queue, including the contents of the last handle. Note: calling this method may cause one or more .on-switch
calls, while the source handle queue is examined, and the source handle queue may get exhausted.
(my = 'foo'.IO).spurt: 'foo';(my = 'bar'.IO).spurt: 'bar';with IO::CatHandle.new: :on-switch, ,
The same caveats for non-seekable handles and empty files that apply to IO::Handle.eof apply here.
class IO::Handle
From IO::Handle
(IO::Handle) method eof
Defined as:
method eof(IO::Handle: --> Bool)
Non-blocking. Returns True
if the read operations have exhausted the contents of the handle. For seekable handles, this means current position is at or beyond the end of file and seeking an exhausted handle back into the file's contents will result in eof returning False
again.
On non-seekable handles and handles opened to zero-size files (including special files in /proc/
), EOF won't be set until a read operation fails to read any bytes. For example, in this code, the first read
consumes all of the data, but it's only until the second read
that reads nothing would the EOF on a TTY handle be set:
$ echo "x" | perl6 -e 'with $*IN { .read: 10000; .eof.say; .read: 10; .eof.say }'FalseTrue