In IO::CatHandle§
See primary documentation in context for method getc
method getc(IO::CatHandle:D: --> Bool:D)
Returns a single character of input from the handle. All the caveats described in IO::Handle.getc
apply. Returns Nil
when there is no more input. It is an error to call this method when the handle is in binary mode, resulting in X::IO::BinaryMode
exception being thrown.
(my $f1 = 'foo'.IO).spurt: 'I ♥ Raku'; (my $f2 = 'bar'.IO).spurt: 'meow'; my $cat = IO::CatHandle.new: $f1, $f2; .say while $_ = $cat.getc; # OUTPUT: «I ♥ Rakumeow»
In IO::Handle§
See primary documentation in context for routine getc
method getc(IO::Handle:D: --> Str:D) multi getc (IO::Handle $fh = $*ARGFILES --> Str:D)
Reads a single character from the input stream. Attempting to call this method when the handle is in binary mode will result in X::IO::BinaryMode
exception being thrown. The subroutine form defaults to $*ARGFILES
if no handle is given. Returns Nil
, if no more input is available, otherwise operation will block, waiting for at least one character to be available; these caveats apply:
In Independent routines§
See primary documentation in context for sub getc
multi getc (IO::Handle:D $fh = $*ARGFILES) { $fh.getc }
This routine is a wrapper for the method of the same name in IO::Handle
>. If no Handle
is specified, defaults to $*ARGFILES
.