我使用Dist :: Zilla和一堆插件来检查我的pod,包括语法,链接,覆盖等。我不断重复的一个非常烦人的POD错误是忘记在{{1}之后添加额外的行};例如,我刚刚创建了一个带有pod的模块,如下所示:
=headX
当然,我去查看CPAN页面并意识到我搞砸了,因为整个段落都是head2格式:
是否有任何好的,自动化的方式来检查我是否忘记在=head1 METHODS
=head2 C<wm_graph>
There are three required arguments: ...
If the first arg is ...
(或其他任何内容)与下一段之间放置空格?
答案 0 :(得分:1)
滚动一些perl代码。原油,但它的工作原理。我留下将main()写给你。
sub do_pod_check { my ( $path, ) = @_; my $troubles = 0; open( my $handle, $path ) or die "Can not open file: $path: $!\n"; while ( my $line = <$handle> ) { if ( $line =~ /^=\w+/ ) { my $line2 = <$handle>; if ( $line2 && $line2 =~ /\S/ ) { $line2 =~ s/^\s+//; $line =~ s/\s+$//; #superchomp lines $line2 =~ s/\s+$//; print "$path\[$.]: suspect POD: /", substr($line,0,30), "/", substr($line2,0,30), "/", "\n"; $troubles++; } } } return $troubles; }