On Sat, Mar 25, 2017 at 8:42 PM, Elizabeth Mattijsen <l...@dijkmat.nl> 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 your original code: > > get '/atom' => sub { > my $path = $.meta ~ request.path; > return open($path).slurp-rest; > } > > I would write that as: > > get '/atom' => sub { slurp $.meta ~ request.path } > > Should you wind up with an opened handle, could could use a LEAVE phaser to > make sure the handle gets closed: > > get '/atom' => sub { > LEAVE $.meta.handle.close; > return $.meta.handle.slurp-rest; > } >
Thanks. I've converted all those slurp-rest calls so slurp calls. I am not sure why did I have the slurp-rest in there. That code seems to be at least 2 years old. Anyway, thanks for the explanation. Gabor