#!/usr/bin/perl
use strict;
use File::Copy qw( copy );
use Pod::Readme;
our $VERSION = '0.05';
# TODO
# - use Getopts::Long with better options
# - allow for stream conversion
# - if no input given, parse META.yml and guess
my $input = shift||"";
unless (-r $input) {
print STDERR << "USAGE";
Cannot find input file "$input"
Usage: pod2readme inputfile [outputfile] [type]
USAGE
exit(1);
}
my $output = shift || "README";
my $type = shift || lc($output);
my $parser = Pod::Readme->new( readme_type => $type );
if (-e $output) {
copy( $output, $output . ".bak" );
}
$parser->parse_from_file( $input, $output );
__END__
=pod
=head1 NAME
pod2readme - script to convert POD to README file
=head1 SYNOPSIS
pod2readme lib/Some/Module.pm
=head1 DESCRIPTIONS
Converts POD in the specified file to a F<README> text file. If a
second argument is given, it will use that as the output file and
assume that is the type of file to export:
pod2readme Module.pm COPYING
If need be, this can be overridden in cases where the output file
is not the same as the type, using a third argument:
pod2readme Module.pm Module-Install.HOWTO install
=head1 SEE ALSO
L<Pod::Readme>
=head1 AUTHOR
Robert Rothenberg <rrwo at cpan.org>
=head1 LICENSE
Copyright (c) 2005 Robert Rothenberg. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut