views:

217

answers:

2

Hello! 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)

A: 

I don't have Perl 6, but it looks like you are calling opendir incorrectly. This perl snippet works for me:

my $dh;
opendir $dh, '/home/ar' or die 'Could not open directory';
ar
That does work, in Perl 5, but not in 6.
dsolimano
+1  A: 

opendir is just not yet implemented. Please file a bug report by sending a mail to [email protected].

moritz
I think if such a feature is not implemented, then it is no secret. But will there not be soon a perl6-star-release?
sid_com