Re: write string requires an object with REPR MVMOSHandle
> On 29 Mar 2017, at 12:36, Shlomi Fishwrote: > > On Wed, 29 Mar 2017 12:10:15 +0200 > Timo Paulssen wrote: > >> As part of the IOwesome grant, zoffix is going to fix this error. It's >> what you get when you try to write to or read from or do anything with a >> closed IO::Handle. >> >> When you use "LEAVE:" you're just declaring a label called "LEAVE". >> There are no labels with special function, so your code is equivalent to >> >> sub save { >>my $fh = open('data.txt', :w); >>ohai: $fh.close; >>$fh.print("hello\n"); >> } >> >> so you're opening the file, closing the file, then writing to it. That >> can't work, of course, but the error is also clearly LTA. >> > > Hi Timo! > > What does "LTA" stand for in this context? One thing I learned is to avoid > acronyms as much as possible. Less Than Awesome Liz
Re: write string requires an object with REPR MVMOSHandle
On Wed, 29 Mar 2017 12:10:15 +0200 Timo Paulssenwrote: > As part of the IOwesome grant, zoffix is going to fix this error. It's > what you get when you try to write to or read from or do anything with a > closed IO::Handle. > > When you use "LEAVE:" you're just declaring a label called "LEAVE". > There are no labels with special function, so your code is equivalent to > > sub save { > my $fh = open('data.txt', :w); > ohai: $fh.close; > $fh.print("hello\n"); > } > > so you're opening the file, closing the file, then writing to it. That > can't work, of course, but the error is also clearly LTA. > Hi Timo! What does "LTA" stand for in this context? One thing I learned is to avoid acronyms as much as possible. Regards, Shlomi > HTH > - Timo
Re: write string requires an object with REPR MVMOSHandle
As part of the IOwesome grant, zoffix is going to fix this error. It's what you get when you try to write to or read from or do anything with a closed IO::Handle. When you use "LEAVE:" you're just declaring a label called "LEAVE". There are no labels with special function, so your code is equivalent to sub save { my $fh = open('data.txt', :w); ohai: $fh.close; $fh.print("hello\n"); } so you're opening the file, closing the file, then writing to it. That can't work, of course, but the error is also clearly LTA. HTH - Timo
write string requires an object with REPR MVMOSHandle
I was running the following buggy code: sub save { my $fh = open('data.txt', :w); LEAVE: $fh.close; $fh.print("hello\n"); } save(); (note the : after the LEAVE) Which if I am not mistaken is basically the same as: sub save { my $fh = open('data.txt', :w); $fh.close; $fh.print("hello\n"); } save(); and I kept getting the error in the subject which greatly confused me. Shouldn't this be something like a "print of closed filehandle" error? Gabor