2 # Time-stamp: "2000-10-02 14:48:15 MDT"
4 # Parse the given HTML file(s) and dump the parse tree
6 # htmltree -D3 -w file1 file2 file3
7 # -D[number] sets HTML::TreeBuilder::Debug to that figure.
8 # -w turns on $tree->warn(1) for the new tree
15 BEGIN { # We have to set debug level before we use HTML::TreeBuilder.
16 $HTML::TreeBuilder::DEBUG = 0; # default debug level
18 while(@ARGV) { # lameo switch parsing
19 if($ARGV[0] =~ m<^-D(\d+)$>s) {
20 $HTML::TreeBuilder::DEBUG = $1;
21 print "Debug level $HTML::TreeBuilder::DEBUG\n";
23 } elsif ($ARGV[0] =~ m<^-w$>s) {
32 use HTML::TreeBuilder;
34 foreach my $file (grep( -f $_, @ARGV)) {
39 my $h = HTML::TreeBuilder->new;
40 $h->ignore_unknown(0);
42 $h->parse_file($file);
46 $h = $h->delete(); # nuke it!