stevieb has asked for the wisdom of the Perl Monks concerning the following question:
So, I've spent an hour or two every night this week reading through the perl6 intro, and several of the various official perl6 docs, but I've run into an issue. I don't know if this is my problem, or a problem with the docs.
From the open() documentation, there is the following code example (spurt() simply prints something to the file):
my $fh = open("test", :w); spurt $fh, "stuff\n";
But when I test it (code is verbatim, the line num in the error is the spurt() line):
my $wfh = open("in.txt", :w); spurt $wfh, "a\n"; $wfh.close;
... it results in:
Type check failed in binding $path; expected Cool but got IO::Handle ( +IO::Handle.new(:path(...) in block <unit> at nl.pl6 line 2
Can someone explain where I'm going wrong? If it's relevant, I just installed the most recent p6 bits yesterday afternoon.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl6: unexpected exception when printing to a writable file handle
by stevieb (Canon) on May 28, 2016 at 14:54 UTC | |
by Zoffix (Acolyte) on May 28, 2016 at 17:58 UTC | |
by stevieb (Canon) on May 28, 2016 at 19:33 UTC | |
by raiph (Deacon) on May 29, 2016 at 23:03 UTC | |
by stevieb (Canon) on May 28, 2016 at 19:24 UTC |