#!/usr/local/bin/perl -w
#
# bug.pl -- demonstrates segfault with API version 2 and unbroken_text.
#

##
## Main
##

use strict;
use HTML::Parser ();

my $p = Buggy->new( api_version   => 2,
		    unbroken_text => 1, ## must be 1 
		    );                  ## to reproduce bug

$p->parse_file("problem.html");

##
## Package Buggy
##

package Buggy;

use strict;
use base qw(HTML::Parser);

sub text {
    my ($self, $text) = @_;
    
    print STDERR "$text\n----- END CHUNK -----\n";
    @_ = split(/\W/, $text); ## this causes the segfault
}



