Please use "$.source_dir/authors.txt".IO.lines instead of open + lines.
with the former you're expressing you really only want to read all the
lines out of the file and be done with it. when you open and then call
.lines, you're saying nothing about what you want to do with the file
handle
I still get the same error.
I just found another case of slurp-rest which might have been the
cause but it might be good time to
look at the few other cases of "open" in my code. (And later maybe
also the code of Bailador itself.)
I tried to read more about how I am supposed to close file handles
On Sat, Mar 25, 2017 at 8:42 PM, Elizabeth Mattijsen wrote:
> $file.IO.slurp and slurp($file) are basically the same.
>
> $handle.slurp-rest does *not* close the handle, as another process might
> still be writing to it, so you could do another .slurp-rest.
>
>
> To get back to
$file.IO.slurp and slurp($file) are basically the same.
$handle.slurp-rest does *not* close the handle, as another process might still
be writing to it, so you could do another .slurp-rest.
To get back to your original code:
get '/atom' => sub {
my $path = $.meta ~ request.path;
Oh so you say that's indeed a bug in my code. That's a relief. Thanks!
As I can see I had some $file.IO.slurp and some of the slurp-rest ones.
What is the difference between $file.IO.slurp and slurp($file) ?
Is the latter just an alias for the former?
Gabor
On Sat, Mar 25, 2017 at 4:54 PM,
i highly suggest you slurp instead of open + slurp-rest, because that
will automatically close the file for you, too.
other than that, you can pass :close to the slurp-rest method and it'll
also close the file.
if you're not closing the files you're opening, you'll be relying on the
garbage
The Perl 6 Maven site runs on Bailador. I've just updated the Rakudo
underneath to 2017.01 and
it seemed to be working fine, but after a while it started crashing
with this error message:
Failed to open file /home/gabor/work/perl6maven-live.com/main.json:
too many open files
in sub at