--- trunk2/all2all.pl 2004/09/12 01:25:55 426 +++ trunk2/all2all.pl 2004/09/15 22:36:23 454 @@ -7,19 +7,38 @@ =cut use strict; -use Data::Dumper; +use YAML; use Carp; +use Getopt::Long; use lib './lib'; use WebPAC; use WebPAC::jsFind; use WebPAC::Index; +use WebPAC::Tree; +# options which can be changed via command line +# +my $code_page = 'ISO-8859-2'; +my ($limit_mfn, $start_mfn, $debug, $low_mem); +my $index_path = './out/index'; + +my $result = GetOptions( + "code_page=s" => \$code_page, + "limit_mfn=i" => \$limit_mfn, + "start_mfn=i" => \$start_mfn, + "debug!" => \$debug, + "low_mem!" => \$low_mem, +); + +# create WebPAC object +# my $webpac = new WebPAC( - code_page => 'ISO-8859-2', - limit_mfn => 500, -# debug => 1, -# low_mem => 1, + code_page => $code_page, + limit_mfn => $limit_mfn, + start_mfn => $start_mfn, + debug => $debug, + low_mem => $low_mem, ) || die; my $log = $webpac->_get_logger() || die "can't get logger"; @@ -27,7 +46,7 @@ $log->debug("creating WebPAC::jsFind object"); my $index = new WebPAC::jsFind( - index_path => './out/index', + index_path => $index_path, keys => 10, ) || die; @@ -63,8 +82,8 @@ my @ds = $webpac->data_structure($rec); if (0 && $log->is_debug) { - $log->debug("rec = ",Dumper($rec)); - $log->debug("ds = ",Dumper(\@ds)); + $log->debug("rec = ",Dump($rec)); + $log->debug("ds = ",Dump(\@ds)); } next if (! @ds); @@ -111,13 +130,13 @@ foreach my $h (@{$ds->{'index'}}) { $thes->{$ds->{'tag'}}->insert( - path => $f, headline => $h, + mfn => $webpac->mfn, ); } } -# print Dumper(\@ds); +# print Dump(\@ds); } @@ -141,35 +160,23 @@ } if (0 && $log->is_debug) { - $log->debug("lookup hash: ",Dumper($webpac->{'lookup'})); - $log->debug("data hash: ",Dumper($webpac->{'data'})); + $log->debug("lookup hash: ",Dump($webpac->{'lookup'})); + $log->debug("data hash: ",Dump($webpac->{'data'})); foreach my $t (keys %{$thes}) { - $log->debug("thesaurus $t hash: ",Dumper($thes->{$t})); + $log->debug("thesaurus $t hash: ",Dump($thes->{$t})); } } } # XXX if(0) -$log->info("lookup hash: ",Dumper($webpac->{'lookup'})); +$log->debug("lookup hash: ",Dump($webpac->{'lookup'})); + +$log->info("creating tree"); # -# tree dump implementation which shouldn't be here :-) +# define tree structure # -my $file = 'out/browse.html'; -open(HTML, "> $file") || $log->logdie("can't open '$file'"); - -print HTML qq{ - - - Browse - - - - - - - -}; - -close(HTML); +my $tree = new WebPAC::Tree( + dir => './out', + html => 'browse.html', + template => './output_template/tree.tt', + js => 'tree-ids.js', + tree => \@tree, +); +$log->info("closing index"); $index->close; $log->info("elapsed time: ",$webpac->fmt_time(time() - $webpac->{'start_t'}));