Generates IRC factoids to feed to the IRC bot. 


git-svn-id: https://svn.apache.org/repos/asf/httpd/docs-build/trunk@1292915 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/irc_factoids.pl b/irc_factoids.pl
new file mode 100755
index 0000000..5150e7b
--- /dev/null
+++ b/irc_factoids.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+use XML::Simple;
+use Getopt::Std;
+use Data::Dumper;
+use strict;
+
+our ( $opt_m, $opt_v );
+our $VERSION = '0.01';
+
+getopts("m:v:");
+HELP_MESSAGE('The -m option is required.') unless $opt_m;
+
+$opt_m =~ s/\.xml$//;
+HELP_MESSAGE('File '. $opt_m . '.xml not found.') unless -f $opt_m . '.xml';
+
+my $file = $opt_m . '.xml';
+my $v = $opt_v ? $opt_v : 'current';
+
+my $xs = XML::Simple->new();
+my $xml = $xs->XMLin( $file );
+
+my @directives;
+foreach my $directive ( sort( keys %{ $xml->{directivesynopsis} } ) ) {
+    print $directive . "\n";
+    print 'http://httpd.apache.org/docs/' . $v . '/mod/' . $opt_m .  '.html#' . lc( $directive ) .  "\n";
+
+    my $d = $xml->{directivesynopsis}->{$directive};
+
+    my $desc = $d->{description}; $desc =~ s/[\r\n]/ /gs;
+    print $desc . "\n";
+    print 'Default: ' . $d->{default} . "\n";
+    print 'Override: ' . $d->{override} . "\n";
+    print 'Context: ' . ( join ', ', @{ $d->{contextlist}->{context} } ) . "\n";
+    print "\n\n";
+
+}
+print "\n";
+
+sub HELP_MESSAGE {
+    print shift;
+    print STDERR qq~
+
+Usage: 
+
+cd manual/mod
+../../review_translations.pl -m mod_rewrite
+
+Outputs IRC factoids for the directives in this module, which can then
+be fed to the IRC bot.
+
+-m mod_foo - Run for mod_foo.
+
+-v version - Generate URLs for this version. Defaults to "current"
+
+~;
+
+    exit();
+}
+
+