Search code examples
perlrakuopendir

How does opendir work in Perl 6?


Can someone tell me, why the "opendir" doesn't work?

#!/usr/bin/env perl6
use v6;

my $file = 'Dokumente/test_file';

if ( my $fh = open $file, :r ) {
    for $fh.lines -> $line {
    say $line;
    }
} else {
    say "Could not open '$file'";
}


my $dir = 'Dokumente';

my $dh = opendir $dir err die "Could not open $dir: $!";

Output:

Hello, World!
Line 2.
Last line.

Could not find non-existent sub &opendir
current instr.: '_block14' pc 29 (EVAL_1:0)
called from Sub '!UNIT_START' pc 1163 (src/glue/run.pir:20)
called from Sub 'perl6;PCT;HLLCompiler;eval' pc -1 ((unknown file):-1)
called from Sub 'perl6;PCT;HLLCompiler;evalfiles' pc 1303 (compilers/pct/src/PCT/HLLCompiler.pir:707)
called from Sub 'perl6;PCT;HLLCompiler;command_line' pc 1489 (compilers/pct/src/PCT/HLLCompiler.pir:794)
called from Sub 'perl6;Perl6;Compiler;main' pc -1 ((unknown file):-1)


Solution

  • opendir is just not yet implemented. Please file a bug report by sending a mail to rakudobug@perl.org.