3 # Shows how to edit text in an HTML document.
6 my $code = shift || usage();
7 $code = 'sub edit_print { local $_ = shift; ' . $code . '; print }';
12 use HTML::Parser 3.05;
13 my $p = HTML::Parser->new(unbroken_text => 1,
14 default_h => [ sub { print @_; }, "text" ],
15 text_h => [ \&edit_print, "text" ],
18 my $file = shift || usage();
19 $p->parse_file($file) || die "Can't open file $file: $!\n";
24 $progname =~ s,^.*/,,;
25 die "Usage: $progname <perlexpr> <filename>\n";