opened
ErrorsCollection

opened

Synthesised documentation from type/IO/Handle type/IO/CatHandle

From type/IO/Handle

See Original text in context

method opened(IO::Handle:D: --> Bool:D)

Returns True if the handle is open, False otherwise.

From type/IO/CatHandle

See Original text in context

method opened(IO::CatHandle:D: --> Bool:D)

Returns True if the invocant has any source handles, False otherwise.

say IO::CatHandle.new      .opened# OUTPUT: «False␤» 
say IO::CatHandle.new($*IN).opened# OUTPUT: «True␤» 
 
(my $f1 = 'foo'.IO).spurt: "A\nB\nC";
with IO::CatHandle.new: $f1 {
    .opened.say# OUTPUT: «True␤» 
    .slurp;
    .opened.say# OUTPUT: «False␤» 
}