http://qs321.pair.com?node_id=55079
Category: Utility Scripts
Author/Contact Info ryddler ryddler@cu-online.com
Description: Searches the site and lib directories on an ActiveState install for any POD that isn't in HTML format and converts it. Rebuilds HTML TOC after conversion. A logfile is kept to track additions.
#! perl -w

###########################################################
# Just a quick and dirty utility to search for POD that 
# hasn't been converted to HTML by an install or was simply
# unzipped or copied into the site or lib subdirectories. 
# Checks to see if an existing .html version of the POD 
# exists, if not converts it to HTML. After conversion the 
# AS Docs TOC is rebuilt so that all newly added docs are listed.

use strict;
use Pod::Html;
use Pod::Find qw(pod_find);
use ActivePerl::DocTools;
use File::Path;

my $infile_path_root = "c:/perl";
my $outfile_path_root = "c:/perl/html";
my $logfile = "c:/perl/allpod.txt";

open LOGFILE, ">>$logfile" || die "couldn't open LOGFILE $logfile\n";
&search_for_pod;
print LOGFILE "-" x 60, "\n";
close LOGFILE;
ActivePerl::DocTools::WriteTOC();

sub search_for_pod {
    my %pods = pod_find({ -verbose => 0, -inc => 1 });
    foreach(sort keys %pods) {
        convert_pod($_);
    }
}

sub convert_pod {
    my $podfile = shift;
    $podfile =~ s#\\#/#g;
    if ($podfile =~ m!$infile_path_root/(.*)/(\w+)\.p.+$!i) {
        my $path = $1;
        my $name = $2;
        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=site/lib:lib",
            );
            print LOGFILE "-- Created $outfile_path_root/$path/$name.h
+tml\n";
        }
    }
}