#!/usr/bin/perl BEGIN { print "main BEGIN block\n"; } use HTML::TreeBuilder; # use LeakFinder; #my $x = Snonk->new; #my $y = Snonk->new($x, bless([1..100000] => 'LeakFinder')); # $x->add_subobj($y, $x, $y); #undef $x->{x}; #undef $y->{x}; #undef $x->{subobjs}; #undef $y->{subobjs}; my $tree = HTML::TreeBuilder->new; # empty tree $tree->parse_file('/home/mjd/public_html/perl/index.html'); $tree->delete; END { print "main END block\n"; } package Snonk; sub new { my $class = shift; my @sub = @_; my $self = {}; $self->{subobjs} = \@sub if @sub; $self->{x} = $self; bless $self => $class; } sub add_subobj { my $self = shift; push @{$self->{subobjs}}, @_; } sub DESTROY { print "True Snonk::DESTROY @_\n"; }