home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / podlint < prev    next >
Encoding:
Text File  |  2001-12-06  |  1.5 KB  |  71 lines

  1. #!/usr/bin/perl -w
  2.  
  3. use Pod::POM;
  4. use Getopt::Std;
  5. use File::Basename;
  6.  
  7. my $program = basename($0);
  8.  
  9. my %opts;
  10. getopts('fh', \%opts);
  11. die usage() if $opts{ h };
  12.  
  13. my $file = shift || die usage();
  14.  
  15. my $parser = Pod::POM->new( warn => 1, code => 1 )
  16.     || die "$Pod::POM::ERROR\n";
  17.  
  18. my $pom = $parser->parse_file($file)
  19.     || die $parser->error(), "\n";
  20.  
  21. print $pom if $opts{ f };
  22.  
  23.  
  24. sub usage {
  25.     return <<EOF;
  26. usage: $program [-f] file
  27.  
  28. Checks Pod file for well-formedness, printing warnings to STDERR.  
  29. The -f option can be set to fix problems (where possible), printing 
  30. the modified output to STDOUT.
  31. EOF
  32. }
  33.  
  34. =head1 NAME
  35.  
  36. podlint - check POD for correctness using Pod::POM
  37.  
  38. =head1 SYNOPSIS
  39.  
  40.     podlint MyFile.pm
  41.  
  42. =head1 DESCRIPTION
  43.  
  44. This script uses Pod::POM to parse a Pod document with full 
  45. warnings enabled, effectively acting as a syntax and structure
  46. checker.
  47.  
  48. The -f option can be specified to have the parsed Pod Object Model
  49. printed to STDOUT with any markup errors fixed.  Note there are some
  50. critical parse errors that can't be handled and fixed by the parser
  51. and in this case the script will terminate reporting the error.
  52.  
  53. =head1 AUTHOR
  54.  
  55. Andy Wardley E<lt>abw@kfs.orgE<gt>
  56.  
  57. =head1 VERSION
  58.  
  59. This is version 0.2 of podlint.
  60.  
  61. =head1 COPYRIGHT
  62.  
  63. Copyright (C) 2000, 2001 Andy Wardley.  All Rights Reserved.
  64.  
  65. This module is free software; you can redistribute it and/or
  66. modify it under the same terms as Perl itself.
  67.  
  68. =head1 SEE ALSO
  69.  
  70. For further information please see L<Pod::POM>.
  71.