Revision 1 (by moose, 2006/07/20 11:34:56) initial import
#!/usr/bin/perl

use warnings;
use strict;
use File::Basename;
use File::Path;
use Pod::Html;

my $root = shift @ARGV;
grabfiles($root);

sub grabfiles {
	my $dir = shift;
	print "Get: $dir\n";
	
	opendir D, $dir or die "failed to open folder '$dir': $!\n";
	for my $ent (readdir D) {
		next if $ent =~ /^\./;
		my $ent_path = $dir . "/" . $ent;

		if(-d $ent_path) {
			grabfiles($ent_path);
			next;
		}

		$ent_path =~ s/^$root$//;
		my ($name,$path,$suffix) = fileparse($ent_path,'.pm','.pl');
		print "name: $name, path: $path, suffix: $suffix\n";
		if($suffix eq '.pm' || $suffix eq '.pl') {
			# do docs

			mkpath('html/' . $path, 1, 0755);
			pod2html("$ent_path",
             "--podpath=.",
			    "--css=perldoc.css",
             "--podroot=$root",
#             "--htmlroot=./html/",
             "--libpods=perlfunc:perlguts:perlvar:perlrun:perlop",
             "--recurse",
             "--infile=$ent_path",
             "--outfile=html/$path/$name.html");

		}
	}
	closedir D;
}