Fwd: pod2html leaves cache files lying around?
authorRajesh Vaidheeswarran <rv@gnu.org>
Tue, 17 Apr 2001 09:35:00 +0000 (05:35 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 18 Apr 2001 22:32:23 +0000 (22:32 +0000)
Message-Id: <E14pVdE-0004P0-00@fencepost.gnu.org>

p4raw-id: //depot/perl@9743

lib/Pod/Html.pm

index 4316823..e61f29a 100644 (file)
@@ -43,6 +43,12 @@ Pod::Html takes the following arguments:
 Adds "Back to Top" links in front of every HEAD1 heading (except for
 the first).  By default, no backlink are being generated.
 
+=item cachedir
+
+    --cachedir=name
+
+Creates the item and directory caches in the given directory.
+
 =item css
 
     --css=stylesheet
@@ -194,6 +200,8 @@ This program is distributed under the Artistic License.
 
 =cut
 
+my $cachedir = ".";            # The directory to which item and directory
+                               # caches will be written.
 my $cache_ext = $^O eq 'VMS' ? ".tmp" : ".x~~";
 my $dircache = "pod2htmd$cache_ext";
 my $itemcache = "pod2htmi$cache_ext";
@@ -565,9 +573,10 @@ $usage =<<END_OF_USAGE;
 Usage:  $0 --help --htmlroot=<name> --infile=<name> --outfile=<name>
            --podpath=<name>:...:<name> --podroot=<name>
            --libpods=<name>:...:<name> --recurse --verbose --index
-           --netscape --norecurse --noindex
+           --netscape --norecurse --noindex --cachedir=<name>
 
   --backlink     - set text for "back to top" links (default: none).
+  --cachedir     - directory for the item and directory cache files.
   --css          - stylesheet URL
   --flush        - flushes the item and directory caches.
   --[no]header   - produce block header/footer (default is no headers).
@@ -600,14 +609,15 @@ Usage:  $0 --help --htmlroot=<name> --infile=<name> --outfile=<name>
 END_OF_USAGE
 
 sub parse_command_line {
-    my ($opt_backlink,$opt_css,$opt_flush,$opt_header,$opt_help,$opt_htmldir,
-       $opt_htmlroot,$opt_index,$opt_infile,$opt_libpods,$opt_netscape,
-       $opt_outfile,$opt_podpath,$opt_podroot,$opt_quiet,$opt_recurse,
-       $opt_title,$opt_verbose);
+    my ($opt_backlink,$opt_cachedir,$opt_css,$opt_flush,$opt_header,$opt_help,
+       $opt_htmldir,$opt_htmlroot,$opt_index,$opt_infile,$opt_libpods,
+       $opt_netscape,$opt_outfile,$opt_podpath,$opt_podroot,$opt_quiet,
+       $opt_recurse,$opt_title,$opt_verbose);
 
     unshift @ARGV, split ' ', $Config{pod2html} if $Config{pod2html};
     my $result = GetOptions(
                            'backlink=s' => \$opt_backlink,
+                           'cachedir=s' => \$opt_cachedir,
                            'css=s'      => \$opt_css,
                            'flush'      => \$opt_flush,
                            'header!'    => \$opt_header,
@@ -635,6 +645,7 @@ sub parse_command_line {
     @libpods  = split(":", $opt_libpods) if defined $opt_libpods;
 
     $backlink = $opt_backlink if defined $opt_backlink;
+    $cachedir = $opt_cachedir if defined $opt_cachedir;
     $css      = $opt_css      if defined $opt_css;
     $header   = $opt_header   if defined $opt_header;
     $htmldir  = $opt_htmldir  if defined $opt_htmldir;
@@ -651,6 +662,8 @@ sub parse_command_line {
 
     warn "Flushing item and directory caches\n"
        if $opt_verbose && defined $opt_flush;
+    $dircache = "$cachedir/pod2htmd$cache_ext";
+    $itemcache = "$cachedir/pod2htmi$cache_ext";
     unlink($dircache, $itemcache) if defined $opt_flush;
 }