I
Ilya Zakharevich
The comment in IO/Handle.pm says:
# There is no need for DESTROY to do anything, because when the
# last reference to an IO object is gone, Perl automatically
# closes its associated files (if any). However, to avoid any
# attempts to autoload DESTROY, we here define it to do nothing.
So how do people destroy the handle without close()ing? I think some
POSIX magic should be done, but which one?
Puzzled,
Ilya
P.S. WHY?
Suppose I make a same-fd duplicate (open "<&=11"). Now I want
to get rid of it - but I must not close() the original handle -
hence not close() the duplicate IO::Handle.
# There is no need for DESTROY to do anything, because when the
# last reference to an IO object is gone, Perl automatically
# closes its associated files (if any). However, to avoid any
# attempts to autoload DESTROY, we here define it to do nothing.
So how do people destroy the handle without close()ing? I think some
POSIX magic should be done, but which one?
Puzzled,
Ilya
P.S. WHY?
Suppose I make a same-fd duplicate (open "<&=11"). Now I want
to get rid of it - but I must not close() the original handle -
hence not close() the duplicate IO::Handle.