HTML::Summary problem

L

Lee

I've been trying to get a fairly simple (should be :) going. Mostly a
cut and paste of what the give on the man page. It keeps on coming up
blank for $summary:

use HTML::Summary;
use HTML::TreeBuilder;

my $tree = new HTML::TreeBuilder;

$tree->parse( 'rock.html' );
$tree->dump;
print "\n" . $tree->as_HTML . "\n";
my $summarizer = new HTML::Summary(
LENGTH => 200,
USE_META => 0,
);
$summary = $summarizer->generate( $tree );
print "Summary=" . $summary;

I'm a still a Perl newbie, so forgive the possible stupidity of this
question :)

btw rock.html exists in the same directory and I can open and read it
in Perl. I'm running from command line and the modules are installed.

Lee
 
L

Lee

Well, to answer my own question, changing one line of the demo program
seemed to make it work:

change:
$tree->parse( $filename );
to:
$tree->parse_file($file_name);

and it works.

Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top