Mike said:
$file is the file being checked for =pod
$0 is the running perl script
Yes, I know what those variables are. I'm telling you that $0 is
redundant - that you would be effectively printing it out twice. die()
already prints it out.
all POD must start with =pod or it is not formatted, yes?
No. =pod is only one of several ways to start POD. Any POD command
(=head1, =over, etc) starts POD formatting. Just look at any of the
modules available on CPAN for examples. (For instance:
http://search.cpan.org/src/NWCLARK/perl-5.8.7/lib/strict.pm )
You may wish to read up on POD syntax:
perldoc perlpod
3) You're grepping through the entire list regardless of whether or not
the pattern is found on the first line. Also a bad idea.
=pod is not required to be on the first line
the first line of a script should be '#!'
the =pod could also be embedded in *.[ch] files or other documents
You miss my point. The point is that if your file is 20,000 lines
long, and you find the pattern you're looking for on line X, you're
still going to search through the remaining 20,000 - X lines of the
file, even though you already know the flag should be set. That's
wasteful.
You're welcome. Please do make sure you also read the other perldoc I
mentioned:
perldoc podchecker
Basically, there is no need for you to write a script to do this. The
program `podchecker` that comes in the standard distribution will
output a message like so:
$ podchecker clpm.pl
clpm.pl does not contain any pod commands.
$ podchecker haspod.pl
haspod.pl pod syntax OK.
Paul Lalli