Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 116590
Status: rejected
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: ZDM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: make DEMOLISH works, when object instantiated with bless
Hi. Sometimes I am using direct bless call instead of ->new for speed. But in this case DEMOLISH method is not called on object destruction. Is it possible to move demolish generator from the ->new method to package execution phase? I don't think, that this will add large overhead, as you wrote in documentation. Much more overhead - is to use ->new each time, when it is not needed.
Hmm, I think, that this will be hard, because you will need to use on scope end hook to detect ->can('DEMOLISH').
On Sat Jul 30 16:24:24 2016, ZDM wrote: Show quoted text
> Hmm, I think, that this will be hard, because you will need to use on > scope end hook to detect ->can('DEMOLISH').
"Implicit make_immutable at first ->new" was an intentional choice. If you're going to bypass the constructor, you're going to have to handle this by hand. I don't particularly want to encourage people to abuse bless() this way. As such, I'm rejecting this ticket.