There is a problem with the Rakudo "open" function. A else tree will
never be executed if the open fails. Here is the output from executing
the code snippet:
[gz...@vgerd2 IO]$ ./open_report.p6
Unable to open filehandle from path '/sdfasfda/asfda/asdfa/Ausgabe.txt'
in Main (file <unknown>, line <unknown>)
[gz...@vgerd2 IO]$
code snippet:
my $filename = '/sdfasfda/asfda/asdfa/Ausgabe.txt';
if my $fh = open($filename, :w) {
for 1..6 -> $num {
$fh.print("$num"); $fh.say('. Zeile');
}
}
else {
# this else-tree will never be executed because the program stops
# if the open fails
$*ERR.say( "Could not open '$filename'" );
}