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

Perl Documentation - Ver 5.28

\n"; print IDX "

Table of Content

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