#!/usr/bin/perl --
# Ebola.pl
use strict;
use warnings;
use HTML::Tree;
Main( @ARGV );
exit( 0 );
sub Main {
my $t = HTML::TreeBuilder->new_from_content(join'','
',0..9,'');
my $f = HTML::TreeBuilder->new_from_content('f');
my $B = $f->look_down( qw' _tag body ' );
print $t->as_HTML, "\n\n";
print '-'x33, "\n\n";
if ( Ebola( $B, 5, eval{ $t->look_down(qw'_tag h1')->as_text } ) ) {
print "Using h1\n";
} elsif ( Ebola( $B, 5, eval{ $t->look_down(qw'_tag h2')->as_text } ) ) {
print "Using h2\n";
} elsif ( Ebola( $B, 5, eval{ $t->look_down(qw'_tag h3')->as_text } ) ) {
print "Using h3\n";
} elsif ( Ebola( $B, 5, eval{ $t->look_down(qw'_tag h4')->as_text } ) ) {
print "Using h4\n\n";
}
print '-' x 33, "\n\n";
print $f->as_HTML, "\n\n";
} ## end sub Main
sub Ebola {
my ( $html, $clip, $text ) = @_;
if ( defined $text and length $text ) {
$text = substr $text, 0, $clip;
$html->push_content($text);
}
} ## end sub Ebola
__END__