docblocks.pl 421 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env perl -w
  2. use strict;
  3. my $filename = $ARGV[0];
  4. if (!$filename) {
  5. print "Usage: docblocks.pl <filename>\n";
  6. exit(1);
  7. }
  8. my %allowed = ("" => 1,
  9. "<?php" => 1);
  10. open(HANDLE, "<", $filename) or die "Cannot open $filename\n";
  11. while (<HANDLE>) {
  12. chomp;
  13. if ($_ =~ /\/\*\*/) {
  14. exit(0);
  15. } elsif (!$allowed{$_}) {
  16. print $filename."\n";
  17. exit(1);
  18. }
  19. }