routine DESTROY
Documentation for routine DESTROY
assembled from the following types:
class IO::CatHandle
From IO::CatHandle
(IO::CatHandle) method DESTROY
Defined as:
method DESTROY(IO::CatHandle:)
Calls .close
. This method isn't to be used directly, but is something that's called during garbage collection.
class IO::Handle
From IO::Handle
(IO::Handle) submethod DESTROY
Defined as:
submethod DESTROY(IO::Handle:)
Closes the filehandle, unless its native-descriptor is 2
or lower. This ensures the standard filehandles do not get inadvertently closed.
Note that garbage collection is not guaranteed to happen, so you must NOT rely on DESTROY
for closing the handles you write to and instead close them yourself. Programs that open a lot of files should close the handles explicitly as well, regardless of whether they were open for writing, since too many files might get opened before garbage collection happens and the no longer used handles get closed.