in reply to How can I call other objects from my object during DESTROY


I think that this is the result of a bug. See the reference to a bug fix in the DESTROY order sequence from the following P5P summary.

I also faced this problem with the Spreadsheet::WriteExcel module when I needed the objects to be DESTROYed in a fixed sequence. I worked around it by having the main container object call destructor methods in the contained objects via DESTROY. This generally works if the scope of the main object has been specified via my(). For cases where it doesn't work I supplied a explicit close() method in the main class and documented it's use.

Nevertheless, I not completely happy with this behaviour and my workaround feels like a kludge.

John.
--

  • Comment on Re: How can I call other objects from my object during DESTROY