William Leeke <[EMAIL PROTECTED]> writes:

> Has anybody else had this problem? 

Oops!  It looks like I forgot to test HTML-Tree with the new magic
parser deallocation code.  The problem is that magic is not copied on
assigment, which means that this code (from HTML::TreeBuilder->new):

  {
    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
  }

doesn't work any more.  The IV-pointer is copied, but the internal
parser state is then killed when $other_self goes out of scope and the
reblessing has no effect.

I am not sure what the best cure is.  I see two options now:

  1) Make a $self->HTML::Parser::init() that can be called to
     set up the HTML::Parser part of the object.  Trouble is that
     this is not automatically v2.2x compatible.

  2) Make _hparser_xs_state be a reference to the magic IV-pointer.
     This give one more level to dereferencing, but should make
     attribute copying ok again.

> Its entirely possible that Ive overlooked something simple here but this
> worked w/ HTML::Parser 3.00 which I can't find anywhere.
> 
> Could someone send me a ref where I could get the old (3.00) version of
> HTML::Parser so I could try that. 

It should still be on CPAN in the modules/by-authors/id/GAAS/
directory.

Regards,
Gisle



> HTML-Tree-0.53# make test
> PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib
> -I/usr/lib/perl5/5.
> 00503/mips-linux -I/usr/lib/perl5/5.00503 -e 'use Test::Harness
> qw(&runtests $ve
> rbose); $verbose=0; runtests @ARGV;' t/*.t
> t/oldparse..........Bad signature in parser state object at 100faa38 at
> blib/lib
> /HTML/Parse.pm line 144.
> dubious
>         Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED test 1
>         Failed 1/1 tests, 0.00% okay
> t/parsefile.........Bad signature in parser state object at 100f7a38 at
> /usr/lib
> /perl5/site_perl/5.005/mips-linux/HTML/Parser.pm line 96.
> dubious
>         Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED test 1
>         Failed 1/1 tests, 0.00% okay
> t/split.............Bad signature in parser state object at 100ff640 at
> t/split.
> t line 30.
> dubious
>         Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED tests 1-147
>         Failed 147/147 tests, 0.00% okay
> Failed Test  Status Wstat Total Fail  Failed  List of failed
> -------------------------------------------------------------------------------
> t/oldparse.t    255 65280     1    1 100.00%  1
> t/parsefile.t   255 65280     1    1 100.00%  1
> t/split.t       255 65280   147  147 100.00%  1-147
> Failed 3/3 test scripts, 0.00% okay. 149/149 subtests failed, 0.00%
> okay.
> make: *** [test_dynamic] Error 2

Reply via email to