Subject: | Support for various formats: text, html, pdf |
Hi Chris,
Very handy module that you have there.
I was wondering if you'd be able to add options for having the README in
different formats, e.g. text, html, pdf.
For text, you can use pod2text, which is bundled with Perl.
For html, you can also use a utility bundled with Perl, pod2html.
For pdf, you can use pod2pdf, but it is a separate CPAN module:
http://search.cpan.org/dist/pod2pdf/bin/pod2pdf
I attached an example of how I currently generate readme files in my
modules. I am happy to help implementing that in M::I::RFP.
Florent
Subject: | auto_readme.pl |
sub auto_readme {
print "*** Building README files...\n";
my $source = 'lib/Grinder.pm';
generate_readme_text( $source, 'README' );
generate_readme_html( $source, 'README.htm' );
return 1;
}
sub generate_readme_text {
my ($in, $out) = @_;
`pod2text $in $out`;
warn "Warning: Could not generate $out.\n$!\n" if $? == -1;
return $?; # exit status
}
sub generate_readme_html {
my ($in, $out) = @_;
`pod2html --infile=$in --outfile=$out`;
warn "Warning: Could not generate $out.\n$!\n" if $? == -1;
rm_files(['pod2htmd.tmp', 'pod2htmi.tmp']);
return $?; # exit status
}
sub rm_files {
my ($files) = @_;
for my $file (@$files) {
if (-e $file) {
unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
}
}
return 1;
}