diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-02-15 07:15:53 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-02-15 07:15:53 +0000 |
commit | d4fb507ee4400b0d1f2d4f71abdd069097dbc581 (patch) | |
tree | d48ce080f8cf64b3a5ce0d322148e8f748dbfe2e /scripts | |
parent | 1346fbb78e2644a3eadc31ffb3e29826014d2f6e (diff) | |
download | brdo-d4fb507ee4400b0d1f2d4f71abdd069097dbc581.tar.gz brdo-d4fb507ee4400b0d1f2d4f71abdd069097dbc581.tar.bz2 |
- Patch #118891 by tanifa: added PerlDoc comments / user generated documentation. Tres cool.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/code-style.pl | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/scripts/code-style.pl b/scripts/code-style.pl index a492bbcfc..5f88748f3 100644 --- a/scripts/code-style.pl +++ b/scripts/code-style.pl @@ -1,25 +1,28 @@ #!/usr/bin/perl -w # $Id$ -# Author: Alexander Schwartz (alexander.schwartz@gmx.net) -# Licence: GPL -# First version: 2001-10-15 +use Pod::Usage; +use Getopt::Long qw(GetOptions); +Getopt::Long::Configure ("bundling"); -# Originally written for Drupal (http://drupal.org/) to ensure stylish -# code. This program tries to show as many improvements as possible with -# no false positives. +my %opt = ( "help" => 0, + 'debug' => 0, + ); -# $Id$ - -$comment = 0; -$program = 0; -if ($ARGV[0] eq '-debug') { - $debug=1; - shift (@ARGV); -} -else { - $debug=0; +if(!GetOptions(\%opt, + 'help|?', + 'debug', + )) { + pod2usage(-exitval => 1, 'verbose'=>0); } + +pod2usage(-exitval => 0, -verbose => 2) if($opt{'help'}); + +$debug = $opt{'debug'}; + +$comment = 0; #flag used to signal we're inside /* */ +$program = 0; #flag used to signal we're inside <?php ?> +#read the file while (<>) { $org=$_; s/\\["']//g; @@ -160,3 +163,33 @@ while (<>) { } continue { close ARGV if eof; } + +__END__ + +=head1 NAME + +code-style.pl - Review drupal code for style + +=head1 SYNOPSIS + + code-style.pl [options] <filename> + + Options: + + -? --help detailed help message + +=head1 DESCRIPTION + +Originally written for Drupal (http://drupal.org/) to ensure stylish +code. This program reviews PHP code, and tries to show as many code +improvements as possible with no false positives. + +=head1 OPTIONS + + --comment + +=head1 EXAMPLES + + ./code-style.pl ../index.php + +=cut |