develooper Front page | perl.perl6.users | Postings from June 2018

Re: IO ???

Thread Previous
Brandon Allbery
June 16, 2018 17:10
Re: IO ???
Message ID:
If you're performing an I/O operation on an IO::Path, either it's a
metadata operation (e.g. file tests) or you are operating on the whole file
(e.g. .lines). In the former case there is no handle; in the latter, the
handle exists only while .lines is active; that is, it exists only within
the implementation of the .lines method, it is not part of the IO::Path

In short, an IO::Path is not a funny-looking handle. IO::Path methods may
internally use private handles, and thereby control their lifetimes. (It
should be closed when it goes out of scope, i.e. when the .lines method is
done, even if it's not explicitly closed.)

On Sat, Jun 16, 2018 at 1:00 PM Xin Cheng <> wrote:

> I am wondering why the IO::Path class doesn't have a "close" method. After
> I read from a file by
> $filename.IO.lines -> $line;
> Am I supposed to close the file, or it is automatically closed for me
> after the reading?
> I tried something like
> $filename.IO.close;
> It is a runtime error. It seems to me that no need to close. Do I
> understand right? If so, why?
> Regards
> Xin
> On Jun 3, 2018, at 1:05 PM, ToddAndMargo <> wrote:
> On Sun, Jun 3, 2018 at 1:01 PM ToddAndMargo < <
> <>>> wrote:
>    Hi All,
>    I have a been looking around the docs pages and I am
>    not finding a list of what the various IO functions do.
>    I would like a list of IO.e does this and IO.d
>    does that.
>    Any such list exist?
>    Many thanks,
>    -T
> On 06/03/2018 10:03 AM, Brandon Allbery wrote:
> It's a bit subtle to track down, but the IO method gives you an IO::Path
> object.
> I had found that, but I did not know what I was looking at.
> Thank you!

brandon s allbery kf8nh                               sine nomine associates                        
unix, openafs, kerberos, infrastructure, xmonad

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About