houseabsolute / Devel-StackTrace

An object representing a stack trace
https://metacpan.org/release/Devel-StackTrace/
Other
7 stars 13 forks source link

Replace no_refs option with unsafe_ref_capture option #6

Closed haarg closed 9 years ago

haarg commented 9 years ago

Capturing refs causes too many options that can't be worked around fully. If used in an exception object, one of this module's most common use cases, capturing objects will keep them alive for as long as the exception object is alive. This can cause issues with objects that expect to be DESTROYed at a certain time. Additionally, if thrown inside a DESTROY sub, the exception object will keep the object being destroyed alive until after the DESTROY sub finishes. The exception object will then be freed, and the DESTROY on the object will be called again.

There is no reliable way to work around those issues, switch to not capturing by default. Rename the option controlling this from no_refs to unsafe_ref_capture, but require it to be set true to capture refs. The previous option will still work if set.

autarch commented 9 years ago

Thanks, I merged this with a few text tweaks from the CLI.