sub new { # constructor! my $class = shift; $class = ref($class) || $class; # Initialize HTML::Element part my $self = $class->element_class->new('html'); { # A hack for certain strange versions of Parser: my $other_self = HTML::Parser->new(); %$self = ( %$self, %$other_self ); # copy fields # Yes, multiple inheritance is messy. Kids, don't try this at home. bless $other_self, "HTML::TreeBuilder::_hideyhole"; # whack it out of the HTML::Parser class, to avoid the destructor }