#!/usr/bin/perl use strict; use warnings; use Storable qw(nstore); use HTML::Entities qw(decode_entities); # --- Configuration --- my $built_site_dir = '../log'; my $output_file = 'search_index.dat'; my %index; print "Building search index from $built_site_dir...\n"; foreach my $path (glob("$built_site_dir/*/index.html")) { next unless open(my $fh, '<:utf8', $path); my $html = do { local $/; <$fh> }; close($fh); # Extract Title and Main Content my ($title) = $html =~ m|