subs

die

sub die(Str $str)

Prints the message to stdout and then exits

flunk

sub flunk(Str $msg)

Prints a message and dies angrily āœ˜.

is

sub is(Str b, Str $msg)

If the two strings are equal, prints the message with a friendly 'āœ”'. Otherwise, displays the two strings and dies with an angry 'āœ˜'.

is File</etc/meaning-of-life.cfg>.slurp,'42',"configured with correct MOL";
ParameterDescription
$aThe string to check
$bThe expected string
$msgThe associated message

list

sub list(List[Str] *@list āŸ¶ List)

Joins arguments on a \n creating a List.

nok

sub nok(Bool msg)

The negated form of ok. Succeeds when the $cond is false.

note

sub note(Str $str āŸ¶ Bool)

Prints its argument to $*ERR with a newline.

ok

sub ok(Bool msg)

If the condition true, ok prints the message with a friendly 'āœ”'. Otherwise, dies with an angry 'āœ˜'.

ok True,"";
ParameterDescription
$condThe success condition
$msgThe associated message

pass

sub pass(Str $msg)

Prints a message with a friendly āœ”.

print

sub print(Str $str)

Prints its argument to $*OUT with no newline.

prompt

sub prompt(Str default āŸ¶ Bool)

Prompts the user with a yes/no question and returns a Bool with the answer. If $*interactive is false then it will just return the default.

if prompt("Did the chicken come before the egg?", :default(True)) {
    say "wrong, the egg came before the chicken.";
} else {
    say "wrong, the chicken DID come before the egg.";
}
ParameterDescription
$questionThe question to pose to the user
:$defaultThe default answer

say

sub say(Str $str āŸ¶ Bool)

Prints its argument to $*OUT with a newline

sleep

sub sleep(Int $seconds)

Suspends execution for an interval of time measured in seconds. note sleep(1) can usually take floating point numbers but they are NYI in spit.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.