Documentation for routine print, assembled from the following types:
multi method print(--> Bool)
Prints value to
$*OUT after stringification using
.Str method without adding a newline at end.
"abc\n".print; # RESULT: «abc␤»
multi sub print(** --> True)
print "Hi there!\n"; # OUTPUT: «Hi there!␤»print "Hi there!"; # OUTPUT: «Hi there!»print [1, 2, 3]; # OUTPUT: «1 2 3»
To print text and include the trailing newline, use
multi method print(** --> True)
Attempting to call this method when the handle is in binary mode will result in
X::IO::BinaryMode exception being thrown.
my = 'path/to/file'.IO.open: :w;.print: 'some text';.close;
multi method print(|)
method print(IO::Socket: Str(Cool) )
Writes the supplied string to the socket, thus sending it to other end of the connection. The binary version is method write.
Fails if the socket is not connected.
method print(Str --> Promise)
Attempt to send
$str on the IO::Socket::Async that will have been obtained indirectly via
listen, returning a Promise that will be kept with the number of bytes sent or broken if there was an error sending.
method print(Proc::Async: Str(Any) , : = )
Write the text data in
$str to the standard input stream of the external program, encoding it as UTF-8.
Returns a Promise that will be kept once the data has fully landed in the input buffer of the external program.
Proc::Async object must be created for writing (with
Proc::Async.new(:w, $path, @args)). Otherwise an X::Proc::Async::OpenForWriting exception will the thrown.
start must have been called before calling method print, otherwise an X::Proc::Async::MustBeStarted exception is thrown.