Dear monks, I am trying to learn oop by reading perldoc. In perlobj, there is a short code 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;
and the output is like this;
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
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.

In reply to about destructor by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.