use strict; use Pod::Html; use Pod::Find qw(pod_find); use File::Path; my $infile_path_root = "C:/MySw/Strawberry5.28x64/perl"; my $outfile_path_root = "C:/MySw/Strawberry5.28x64/html"; my $alternativeIndexFile = "$outfile_path_root/my_alternative_index.html"; my $logfile = "C:/MySw/Strawberry5.28x64/allpod.txt"; my %pods = pod_find({ -verbose => 0, -inc => 1 }); my (@sorted); foreach my $podfile (keys %pods) { $podfile =~ s#\\#/#g; my ($path,$name) = ($podfile =~ m!^$infile_path_root(/.+)?/([^\/]+)\.(pod|pm|pl)$!io); my (@depth) = ($path =~ /(\/)/go); my $depth = scalar @depth; my $sorted = sprintf("%010d%-s",$depth,$podfile); push(@sorted,$sorted); } open INDEX, ">$alternativeIndexFile" || die "Cannot open $alternativeIndexFile\n"; print INDEX "Strawberry Perl Documentation - Version 5.28\n"; print INDEX "\n
\n

Strawberry Perl Documentation - Version 5.28

\n"; print INDEX "

Table of Content

\n"; open LOG, ">$logfile" || die "Cannot open $logfile\n"; pmpod2html(); close(LOG); print INDEX "
\n\n"; close(INDEX); sub pmpod2html { my ($prepath,$predepth); foreach my $podfile (sort @sorted) { $podfile =~ s/^\d{10}//o; my ($path,$name) = ($podfile =~ m!^$infile_path_root(/.+)?/([^\/]+)\.(pod|pm|pl)$!io); $path =~ s/^\///o; my (@depth) = ($path =~ /(\/)/go); my $depth = scalar @depth; print INDEX '' x$predepth . "\n" . '
' x$depth . "\n\n" . "$path
\n" if($prepath ne $path); if (! -e "$outfile_path_root/$path/$name\.html") { mkpath("$outfile_path_root/$path"); pod2html( "--infile=$podfile", "--outfile=$outfile_path_root/$path/$name.html", "--podroot=$infile_path_root", "--podpath=lib:site:vendor", ); my ($htmlfile); open(IN,"<$outfile_path_root/$path/$name.html") || die "Cannot open $outfile_path_root/$path/$name.html\n"; while() { $htmlfile .= $_; } my ($title) = ($htmlfile =~ /\s*(.+?)\s*<\/title>/ios); close(IN); print LOG "$podfile\n"; if($title) { print INDEX "$title: <a href=\"$path/$name.html\">$name.html</a><br>\n"; } else { print INDEX "<a href=\"$path/$name.html\">$name.html</a><br>\n"; } } $prepath = $path; $predepth = $depth; } }