#!/usr/bin/perl -w

use Pod::POM;
use Getopt::Std;

my %opts;
getopts('fh', \%opts);
die usage() if $opts{ h };

my $file = shift || die usage();

my $parser = Pod::POM->new( warn => 1, code => 1 )
    || die "$Pod::POM::ERROR\n";

my $pom = $parser->parse_file($file)
    || die $parser->error(), "\n";

print $pom if $opts{ f };


sub usage {
    return <<EOF;
usage: $0 [-f] file

Checks Pod file for well-formedness, printing warnings to STDERR.  
The -f option can be set to fix problems (where possible), printing 
the modified output to STDOUT.
EOF
}
