Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl6: unexpected exception when printing to a writable file handle

by stevieb (Canon)
on May 28, 2016 at 14:54 UTC ( [id://1164396]=note: print w/replies, xml ) Need Help??


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
    Yes, the docs are incorrect. A patch fixing them just went in: https://github.com/perl6/doc/pull/555/files

      As a side question, is there an official location to discuss making potential changes to the docs?

      I'm speaking about many of the docs, but as an example, in Str type doc, I think it would be useful to have a very short brief of what each entry does. eg:

      1. Methods: 2. routine chomp - removes trailing newlines

      If this is wanted, I'd start the process and send PRs. I feel it would help future readers, and if I start this process, it'll allow me to learn very quickly as I'd have to read every single entry (while testing it), and that'd solidify things much faster than reviewing the docs periodically (and missing/not knowing about methods and functions that I don't even know exist).

      Thanks for the clarification, Zoffix! I'm glad that I was reading and understanding things properly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164396]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-24 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found