Bump versions
[catagits/Test-NoTabs.git] / lib / Test / NoTabs.pm
index e8274ec..e88a605 100644 (file)
@@ -10,7 +10,7 @@ use File::Find;
 
 use vars qw( $VERSION $PERL $UNTAINT_PATTERN $PERL_PATTERN);
 
-$VERSION = '0.3.1';
+$VERSION = '1.0';
 
 $PERL    = $^X || 'perl';
 $UNTAINT_PATTERN  = qr|^([-+@\w./:\\]+)$|;
@@ -64,14 +64,14 @@ sub _all_files {
 
 sub notabs_ok {
     my $file = shift;
-    my $test_txt = shift || "Found tabs in '$file'";
+    my $test_txt = shift || "No tabs in '$file'";
     $file = _module_to_path($file);
     open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open $file: $!"); return; };
     my $line = 0;
     while (<$fh>) {
         $line++;
         next if (/^\s*#/);
-        next if (/^\s*=.+/ .. /^\s*=(cut|back|end)/);
+        next if (/^\s*=.+/ .. (/^\s*=(cut|back|end)/ || eof($fh)));
         last if (/^\s*(__END__|__DATA__)/);
         if ( /\t/ ) {
           $Test->ok(0, $test_txt . " on line $line");
@@ -85,8 +85,8 @@ sub notabs_ok {
 sub all_perl_files_ok {
     my @files = _all_perl_files( @_ );
     _make_plan();
-    foreach my $file ( @files ) {
-      notabs_ok($file);
+    foreach my $file ( sort @files ) {
+      notabs_ok($file, "no tabs in $file");
     }
 }
 
@@ -98,7 +98,7 @@ sub _is_perl_script {
     my $file = shift;
     return 1 if $file =~ /\.pl$/i;
     return 1 if $file =~ /\.t$/;
-    open my $fh, $file or return;
+    open (my $fh, $file) or return;
     my $first = <$fh>;
     return 1 if defined $first && ($first =~ $PERL_PATTERN);
     return;
@@ -119,7 +119,7 @@ sub _module_to_path {
 
 sub _make_plan {
     unless ($Test->has_plan) {
-        $Test->plan( no_plan => 1 );
+        $Test->plan( 'no_plan' );
     }
     $Test->expected_tests;
 }
@@ -236,6 +236,10 @@ distribution.
 
 Rick Myers and Emanuele Zeppieri also provided valuable feedback.
 
+Patch to fix warnings provided by Florian Ragwitz (rafl)
+
+Currently maintained by Tomas Doran (t0m) C<bobtfish@bobtfish.net>
+
 =head1 SEE ALSO
 
 L<Test::More>, L<Test::Pod>. L<Test::Distribution>, L<Test:NoWarnings>