Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Find and convert all pod to html

by ryddler (Monk)
on Jan 30, 2001 at 01:33 UTC ( #55079=sourcecode: print w/ replies, xml ) Need Help??

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";
        }
    }
}

Comment on Find and convert all pod to html
Download Code
Re: Find and convert all pod to html
by $code or die (Deacon) on Jan 31, 2001 at 14:36 UTC

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://55079]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-12-21 13:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (105 votes), past polls