my @mfiles;
open my $mfh, '<', $file or die qq{Could not open "$file": $!\n};
while (<$mfh>) {
- next if /^#/;
- push @mfiles => $1 if /(\S.+)/o;
+ next if /^#/;
+ push @mfiles => $1 if /(\S.+)/o;
}
close $mfh or warn qq{Could not close "$file": $!\n};
## Make sure all files in the MANIFEST are "clean": no tabs, no unusual characters
for my $mfile (@mfiles) {
- file_is_clean($mfile);
+ file_is_clean($mfile);
}
sub file_is_clean {
- my $file = shift or die; ## no critic (ProhibitReusedNames)
-
- if (!open $fh, '<', $file) {
- fail qq{Could not open "$file": $!\n};
- return;
- }
- $good = 1;
- my $inside_copy = 0;
- while (<$fh>) {
- if (/^COPY .+ FROM stdin/i) {
- $inside_copy = 1;
- }
- if (/^\\./ and $inside_copy) {
- $inside_copy = 0;
- }
- if (/\t/ and $file ne 'Makefile.PL' and $file !~ /\.html$/ and ! $inside_copy) {
- diag "Found a tab at line $. of $file\n";
- $good = 0;
- }
- if (! /^[\S ]*/) {
- diag "Invalid character at line $. of $file: $_\n";
- $good = 0; die;
- }
- }
- close $fh or warn qq{Could not close "$file": $!\n};
-
- if ($good) {
- pass "The $file file has no tabs or unusual characters";
- }
- else {
- fail "The $file file did not pass inspection!";
- }
+ my $file = shift or die; ## no critic (ProhibitReusedNames)
+
+ if (!open $fh, '<', $file) {
+ fail qq{Could not open "$file": $!\n};
+ return;
+ }
+ $good = 1;
+ my $inside_copy = 0;
+ while (<$fh>) {
+ if (/^COPY .+ FROM stdin/i) {
+ $inside_copy = 1;
+ }
+ if (/^\\./ and $inside_copy) {
+ $inside_copy = 0;
+ }
+ if (/\t/ and $file ne 'Makefile.PL' and $file !~ /\.html$/ and ! $inside_copy) {
+ diag "Found a tab at line $. of $file\n";
+ $good = 0;
+ }
+ if (! /^[\S ]*/) {
+ diag "Invalid character at line $. of $file: $_\n";
+ $good = 0; die;
+ }
+ }
+ close $fh or warn qq{Could not close "$file": $!\n};
+
+ if ($good) {
+ pass "The $file file has no tabs or unusual characters";
+ }
+ else {
+ fail "The $file file did not pass inspection!";
+ }
}
-e $filename or die qq{Could not find "$filename"!};
open my $oldstderr, '>&', \*STDERR or die 'Could not dupe STDERR';
close STDERR or die qq{Could not close STDERR: $!};
- my @vio;
- my $ranok = 0;
- eval {
- @vio = $critic->critique($filename);
- $ranok = 1;
- };
- if (! $ranok) {
- pass "Perl::Critic failed for file $filename. Error was: $@\n";
- $@ = undef;
- next;
- }
+ my @vio;
+ my $ranok = 0;
+ eval {
+ @vio = $critic->critique($filename);
+ $ranok = 1;
+ };
+ if (! $ranok) {
+ pass "Perl::Critic failed for file $filename. Error was: $@\n";
+ $@ = undef;
+ next;
+ }
open STDERR, '>&', $oldstderr or die 'Could not recreate STDERR'; ## no critic
close $oldstderr or die qq{Could not close STDERR copy: $!};
my $vios = 0;
skip 'Need Pod::Text to re-test the spelling of embedded POD', 1;
}
- my $parser = Pod::Text->new (quotes => 'none');
+ my $parser = Pod::Text->new (quotes => 'none');
for my $file (qw{check_postgres.pl}) {
if (! -e $file) {
fail(qq{Could not find the file "$file"!});
}
- my $string;
- my $tmpfile = "$file.tmp";
+ my $string;
+ my $tmpfile = "$file.tmp";
$parser->parse_from_file($file, $tmpfile);
- next if ! open my $fh, '<', $tmpfile;
- { local $/; $string = <$fh>; }
- close $fh or warn "Could not close $tmpfile\n";
- unlink $tmpfile;
+ next if ! open my $fh, '<', $tmpfile;
+ { local $/; $string = <$fh>; }
+ close $fh or warn "Could not close $tmpfile\n";
+ unlink $tmpfile;
spellcheck("POD from $file" => $string, $file);
}
}