Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and the output is like this;#!/usr/bin/perl -w #name: monk_perlobj # note: copied from perlobj # purpose: to understand DESTORY block for object package Subtle; sub new { my $test; $test = \$test; warn "CREATING ". \$test; return bless \$test; } sub DESTORY { my $self = shift; warn "DESTORYING $self"; } package main; warn "starting program"; { my $a = Subtle->new; my $b = Subtle->new; $$a = 0; #break selfref warn "leaving block"; } warn "just exited block"; warn "time to die ..."; exit;
but the corresponding output from perlobj actually has two other lines from the destructor block. Could someone tell me why I am not able to see them? Is it related how perl was bulit and how can I check it. thanks very much indeed.starting program at ./monk_perlobj line 23. CREATING REF(0x816b8e8) at ./monk_perlobj line 12. CREATING REF(0x81523ec) at ./monk_perlobj line 12. leaving block at ./monk_perlobj line 28. just exited block at ./monk_perlobj line 31. time to die ... at ./monk_perlobj line 32
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: about destructor
by Ultra (Hermit) on Oct 24, 2005 at 16:04 UTC | |
by revdiablo (Prior) on Oct 24, 2005 at 16:43 UTC | |
by radiantmatrix (Parson) on Oct 24, 2005 at 17:40 UTC | |
by japhy (Canon) on Oct 24, 2005 at 16:15 UTC |