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.bat < prev    next >
Encoding:
DOS Batch File  |  2003-11-12  |  1.9 KB  |  87 lines

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