The flush routine

Combined from primary sources listed below.

In role Metamodel::Mixins ( Type/Metamodel/Mixins )§

See primary docmentation in context for method flush.

method flush_cache§

method flush_cache($obj)

No-op.

In class IO::Handle ( Type/IO/Handle )§

See primary docmentation in context for method flush.

method flush§

method flush(IO::Handle:D: --> True)

Will flush the handle, writing any of the buffered data. Returns True on success; otherwise, fails with X::IO::Flush.

given "foo".IO.open: :w {
    LEAVE .close;
    .print: 'something';
    'foo'.IO.slurp.say# (if the data got buffered) OUTPUT: «␤»
    .flush;             # flush the handle
    'foo'.IO.slurp.say# OUTPUT: «something␤»
}