On Apr 2, 2004, at 6:55 AM, Eric Lease Morgan wrote:


Thank you for the prompt replies, but the suggestions are overkill. I simply want to:

  1. create a doc directory
  2. loop through my lib directory looking for pods
  3. convert each pod to xhtml
  4. save converted files to the pod directory

Like this, but there has got to be a better way:


#!/usr/bin/perl

use File::Basename;
use File::Find;

my $POD2HTML = 'pod2html';

my $IN  = $ARGV[0];
my $OUT = $ARGV[1];

find (\&process_files, $IN);
exit;

sub process_files {

  # get the name of the found file
  my $file = $File::Find::name;

  # make it has the correct extension
  next if ($file !~ m/\.pm$/);

# extract the necessary parts of the file name
(my $name, my $path, my $suffix) = File::Basename::fileparse($file, '\..*');


my $cmd = $POD2HTML . " --outfile=$OUT/$name.html --title=$name $file";
print "$cmd\n";
system $cmd;

}


--
Eric Lease Morgan



Reply via email to