add debugging to agent.cgi, make sure warnings are turned off when parsing templates...
[freeside.git] / bin / pod2x
1 #!/usr/bin/perl
2
3 #use Pod::Text;
4 #$Pod::Text::termcap=1;
5
6 my $site_perl = "./FS";
7 #my $catman = "./catman";
8 #my $catman = "./htdocs/docs/man";
9 #my $html = "./htdocs/docs/man";
10 my $html = "./httemplate/docs/man";
11
12 $|=1;
13
14 die "Can't find $site_perl" unless -d $site_perl;
15 #die "Can't find $catman" unless -d $catman;
16 die "Can't find $html" unless -d $html;
17
18 #make some useless links
19 foreach my $file (
20   glob("$site_perl/bin/freeside-*"),
21 ) {
22   next if $file =~ /\.pod$/;
23   #symlink $file, "$file.pod"; # or die "link $file to $file.pod: $!";
24   system("cp $file $file.pod");
25 }
26
27 foreach my $file (
28   glob("$site_perl/*.pm"),
29   glob("$site_perl/*/*.pm"),
30   glob("$site_perl/*/*/*.pm"),
31   glob("$site_perl/bin/*.pod"),
32   glob("./fs_sesmon/FS-SessionClient/*.pm"),
33   glob("./fs_signup/FS-SignupClient/*.pm"),
34   glob("./fs_selfadmin/FS-MailAdminServer/*.pm"),
35 ) {
36   next if $file =~ /(^|\/)blib\//;
37   #$file =~ /\/([\w\-]+)\.pm$/ or die "oops file $file";
38   my $name;
39   if ( $file =~ /fs_\w+\/FS\-\w+\/(.*)\.pm$/ ) {
40     $name = "FS/$1";
41   } elsif ( $file =~ /$site_perl\/(.*)\.(pm|pod)$/ ) {
42     $name = $1;
43   } else {
44     die "oops file $file";
45   }
46   print "$name\n";
47   my $htmlroot = join('/', map '..',1..(scalar($file =~ tr/\///)-2)) || '.';
48 #  system "pod2text $file >$catman/$name.txt"; 
49   system "pod2html --podroot=$site_perl --podpath=./FS:./FS/UI:.:./bin --norecurse --htmlroot=$htmlroot $file >$html/$name.html";
50   #system "pod2html --podroot=$site_perl --htmlroot=$htmlroot $file >$html/$name.html";
51 #  system "pod2html $file >$html/$name.html";
52 }
53
54 #remove the useless links
55 unlink glob("$site_perl/bin/*.pod");
56