note
Ven'Tatsu
I wouldn't call it easyer but at the first detection of a pod directive I would set the flag an bail out of the loop instead of searching the rest of the file. It is also posible that a file will not contain '=pod' but still have pod in it. I would use something like this:
<code>
my $file = '/tmp/file';
open(IN, "<$file") or die "$0: cannot read file '$file': $!";
my $pod = 0;
while (<IN>) { $pod = 1, last if /^=\w/ }
#/^=(pod|head\d|over|item|back|cut)/ might be more accurate
#=begin, =end, and =for are ommited because they would
#usualy be ignored by pod2*
close(IN);
pod2html($file) if $pod;
</code>
484436
484436