Documentation for routine say

Documentation for routine say, assembled from the following types:

class Mu

From Mu

(Mu) method say

multi method say(--> Bool:D)

Prints value to $*OUT after stringification using .gist method with newline at end. To produce machine readable output use .put.

say 42;                 # OUTPUT: «42␤» 

role IO

From IO

(IO) sub say

Defined as:

multi sub say(**@args --> True)

Prints the "gist" of given objects. Same as put, except coerces non-Str arguments using .gist method.

NOTE: the .gist method of some objects, such as Lists, returns only partial information about the object (hence the "gist"). If you mean to print textual information, you most likely want to use put instead.

say Range;        # OUTPUT: «(Range)␤» 
say class Foo {}# OUTPUT: «(Foo)␤» 
say 'I ♥ Perl6';  # OUTPUT: «I ♥ Perl6␤» 
say 1..Inf;       # OUTPUT: «1..Inf␤» 

class IO::Handle

From IO::Handle

(IO::Handle) method say

Defined as:

multi method say(IO::Handle:D: **@text --> True)

This method is identical to put except that it stringifies its arguments by calling .gist instead of .Str.

Attempting to call this method when the handle is in binary mode will result in X::IO::BinaryMode exception being thrown.

my $fh = open 'path/to/file':w;
$fh.say(;        # RESULT: «3+4i\n» 

class IO::CatHandle

From IO::CatHandle

(IO::CatHandle) method say

Defined as:

multi method say(|)

In Rakudo, the IO::CatHandle type overrides this method to throw X::NYI exception. If you have a good idea for how this method should behave, tell Rakudo developers about it!

class Proc::Async

From Proc::Async

(Proc::Async) method say

method say(Proc::Async:D: $output:$scheduler = $*SCHEDULER)

Calls method gist on the $output, adds a newline, encodes it as UTF-8, and sends it 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.

The Proc::Async object must be created for writing (with, $path, @args)). Otherwise an X::Proc::Async::OpenForWriting exception will the thrown.

start must have been called before calling method say, otherwise an X::Proc::Async::MustBeStarted exception is thrown.