in reply to Perl6: unexpected exception when printing to a writable file handle
Another case of Rubber Duck Debugging... (and not reading enough docs).
From the spurt() docs:
To write to an IO::Handle, use the print method.
So I have to do this:
my $wfh = open("in.txt", :w); $wfh.print("a\n"); $wfh.close;
...or, skip opening the file entirely, and pass the filename to spurt() directly:
spurt "in.txt", "a\n";
So I'll re-review the docs, as the example in my OP appears to be incorrect (I'll submit a patch if this turns out to be the case after more testing).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl6: unexpected exception when printing to a writable file handle
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 |