locked_user sundialsvc4 has asked for the wisdom of the Perl Monks concerning the following question:
I thought that this code-snippet would call DEMOLISH (in Moose)... but it doesn't seem to do so:
my $foo = Some::Moose::Object->new(); $foo = undef; # Here...
Assuming (say...):
package Some::Moose::Object; use Moose; sub DEMOLISH { print STDERR "Vanity, vanity, all is vanity...\n"; };
I would intuitively assume that when I set the variable to "undef," it is now “out-of-scope” such that a DESTROY/DEMOLISH routine would now run. However, is my assumption simple-minded?
If that be so, oh monks, when does DESTROY run? I was considering to use it for flushing session-data to disk...
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Am I mistaken about Moose 'DEMOLISH'?
by locked_user sundialsvc4 (Abbot) on Jan 23, 2009 at 18:25 UTC | |
|
Re: Am I mistaken about Moose 'DEMOLISH'?
by Fletch (Bishop) on Jan 23, 2009 at 17:41 UTC | |
|
Re: Am I mistaken about Moose 'DEMOLISH'?
by ikegami (Patriarch) on Jan 23, 2009 at 18:02 UTC | |
|
Re: Am I mistaken about Moose 'DEMOLISH'?
by locked_user sundialsvc4 (Abbot) on Jan 30, 2009 at 02:34 UTC |