— |
#!/usr/bin/perl
use 5.008;
my $warn ;
my $help ;
BEGIN {
$HTML::TreeBuilder::DEBUG = 0;
$warn = 0;
while ( @ARGV ) {
if ( $ARGV [0] =~ m<^-D(\d+)$>s) {
$HTML::TreeBuilder::DEBUG = $1;
print "Debug level $HTML::TreeBuilder::DEBUG\n" ;
shift @ARGV ;
} elsif ( $ARGV [0] =~ m<^-w$>s) {
$warn = 1;
shift @ARGV ;
} elsif ( $ARGV [0] =~ m<^-h$>s) {
$help = 1;
shift @ARGV ;
} else {
last ;
}
}
}
pod2usage({ -exitval => 0, -verbose => 1}) if ( $help );
foreach my $file ( grep ( -f $_ , @ARGV )) {
print
"=" x 78, "\n" ,
"Parsing $file...\n" ;
my $h = HTML::TreeBuilder->new;
$h ->ignore_unknown(0);
$h -> warn ( $warn );
$h ->parse_file( $file );
print "- " x 39, "\n" ;
$h -> dump ();
$h = $h -> delete ();
print "\n\n" ;
}
exit ;
|