6 my $libdir = $r->dir_config("IRSpyLibDir");
7 my $module = utf8param($r, "module");
8 if (!defined $module) {
10 render_doc_links($libdir, "ZOOM", 6);
13 print "<b>Documentation for '$module'</b>\n";
14 { my $dir = "/tmp/pod2html"; mkdir $dir; chdir $dir || die $!; }
15 # For some reason, output to standard output doesn't appear
16 my $name = "ZOOM.html";
17 pod2html("$libdir/$module", "--outfile=$name");
18 open F, "<$name" or die "can't open '$name': $!";
19 my $text = join("", <F>);
21 $text =~ s/.*?<body.*?>//gs;
22 $text =~ s/<\/body.*//gs;
26 sub render_doc_links {
27 my($base, $dir, $level) = @_;
29 my $dh = new IO::Dir("$base/$dir")
30 or die "can't open directory handle for '$base/$dir'";
32 print " " x $level, "<li><b>$dir</b></li>\n";
33 print " " x $level, "<li><ul>\n";
36 while (my $file = $dh->read()) {
37 if ($file eq "." || $file eq ".." || $file eq "CVS") {
39 } elsif (-d "$base/$dir/$file") {
46 foreach my $file (sort @files) {
48 qq[ <li><a href="?module=$dir/$file">$file</a></li>\n]);
51 foreach my $file (sort @dirs) {
52 render_doc_links($base, "$dir/$file", $level+1);
55 print " " x $level, "</ul></li>\n";