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
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";
Parameter | Description |
$a | The string to check |
$b | The expected string |
$msg | The associated message |
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
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,"";
Parameter | Description |
$cond | The success condition |
$msg | The associated message |
pass
sub pass(Str $msg)
Prints a message with a friendly ā.
sub print(Str $str)
Prints its argument to $*OUT
with no newline.
prompt
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.";
}
Parameter | Description |
$question | The question to pose to the user |
:$default | The default answer |
say
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.