X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2Fsynopsis-extractor;h=ecafe6771c26250f690b4cb3978bcc61f27144d8;hb=e225a4bdc7e2ca3d47266b8ec98135f521f727f3;hp=57e7437abad1fa3efc8a12f3f93ba812892b8308;hpb=a4ffdd456d97ad50f05d803977c3f891ae84d052;p=catagits%2FHTML-Zoom.git diff --git a/maint/synopsis-extractor b/maint/synopsis-extractor index 57e7437..ecafe67 100755 --- a/maint/synopsis-extractor +++ b/maint/synopsis-extractor @@ -8,13 +8,7 @@ use File::Find; use File::Spec; sub slurp_file { - undef $/; - open(my $fh, '<', shift) || return; - if(my $whole_file = <$fh>) { - return $whole_file; - } else { - return; - } + local (@ARGV, $/) = ($_[0]); <> } sub extract_synopsis { @@ -22,9 +16,9 @@ sub extract_synopsis { my $head_or_cut = qr[head|cut]x; if($string=~m/^=head1 SYNOPSIS\n(.*?)^=$head_or_cut/sm) { my $extracted = $1; - $extracted=~s/^\S.+?$//m; # wipe out non code lines in pod my $begin_end = qr[begin|end]x; $extracted=~s/\n^=$begin_end testinfo\n\n//smg; # remove test block + $extracted=~s/^\S.+?$//smg; # wipe out non code lines in pod return $extracted; } else { return;