Login
Hook ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL
authorElliot Shank <perl@galumph.com>
Tue, 2 Oct 2007 15:31:31 +0000 (15:31 +0000)
committerElliot Shank <perl@galumph.com>
Tue, 2 Oct 2007 15:31:31 +0000 (15:31 +0000)
into Build.PL and Makefile.PL.

.gitignore
Build.PL
MANIFEST
MANIFEST.SKIP
Makefile.PL
inc/Perl/Critic/BuildUtilities.pm
lib/Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm
t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL
t/generate_without_optional_dependencies_wrappers.PL

index 76c3476..9b4b946 100644 (file)
@@ -1 +1,2 @@
 t/*_without_optional_dependencies.t
+t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
index 426d403..044b2d6 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -96,6 +96,7 @@ my $builder = Module::Build->new(
                         Makefile
                         Makefile.old
                         pm_to_blib
+                        t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
                     >,
                     test_wrappers_to_generate(),
   ],
index 95f824f..100a947 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -217,7 +217,7 @@ t/ControlStructures/ProhibitCascadingIfElse.run
 t/ControlStructures/ProhibitCStyleForLoops.run
 t/ControlStructures/ProhibitDeepNests.run
 t/ControlStructures/ProhibitMutatingListFunctions.run
-t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
+t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL
 t/ControlStructures/ProhibitPostfixControls.run
 t/ControlStructures/ProhibitUnlessBlocks.run
 t/ControlStructures/ProhibitUnreachableCode.run
index bb18d99..66ac671 100644 (file)
@@ -41,6 +41,7 @@ RCS
 \.gdb_history$
 \.ERR$
 ^t/.*_without_optional_dependencies.t$
+^t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run$
 
 # Temp/backup files
 ~$
index a8f2486..51eba59 100644 (file)
@@ -82,7 +82,13 @@ WriteMakefile(
         'String::Format'        => 1.13,
         'Test::More'            => 0,
     },
-    realclean      => { FILES => join q< >, test_wrappers_to_generate() },
+    realclean      => {
+        FILES =>
+            join
+                q< >,
+                test_wrappers_to_generate(),
+                't/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run'
+    },
 );
 
 sub MY::postamble {
index dd34629..fd95c1f 100644 (file)
@@ -80,19 +80,23 @@ sub test_wrappers_to_generate {
 }
 
 sub get_PL_files {
+    my %PL_files;
+
+    $PL_files{'t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL'} =
+        't/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run';
+
     if (should_skip_author_tests()) {
         print
               "\nWill not generate extra author tests.  Set "
             . '$ENV{TEST_AUTHOR} to a true value to have them generated.'
             . "\n\n";
-        return {};
+    }
+    else {
+        $PL_files{'t/generate_without_optional_dependencies_wrappers.PL'} =
+            [ test_wrappers_to_generate() ];
     }
 
-    return {
-        't/generate_without_optional_dependencies_wrappers.PL' => [
-            test_wrappers_to_generate()
-        ],
-    };
+    return \%PL_files;
 }
 
 sub dump_unlisted_or_optional_module_versions {
index 11b39c4..05cb910 100644 (file)
@@ -147,8 +147,16 @@ Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndU
 
 =head1 DESCRIPTION
 
+  until ($foo ne 'blah') {          #not ok
+      ...
+  }
+
+  while ($foo eq 'blah') {          #ok
+      ...
+  }
+
 A number of people have problems figuring out the meaning of doubly
-negated expressions.  Cunless> and C<until> are both negative
+negated expressions.  C<unless> and C<until> are both negative
 constructs, so any negative (e.g. C<!~>) or reversible operators (e.g.
 C<le>) included in their conditional expressions are double negations.
 Conway considers the following operators to be difficult to understand
@@ -160,6 +168,10 @@ within C<unless> and C<until>:
   lt  gt  le  ge  cmp
 
 
+=head1 SEE ALSO
+
+L<Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks>
+
 =head1 AUTHOR
 
 Elliot Shank C<< <perl@galumph.com> >>
index 7d799ab..e67b96f 100644 (file)
@@ -20,7 +20,7 @@ if ($this_program eq $test_file_name) {
         . "This program: $this_program.";
 }
 
-print "Generating $test_file_name.\n";
+print "\n\nGenerating $test_file_name.\n";
 
 
 
@@ -42,7 +42,7 @@ foreach my $operator ( qw/ ne != < > <= >= <=> lt gt le ge cmp / ) {
 
 
 close $test_file;
-print "Done.\n";
+print "Done.\n\n";
 
 #-----------------------------------------------------------------------------
 
index c88059d..0f68ba6 100644 (file)
@@ -21,7 +21,7 @@ use Perl::Critic::BuildUtilities qw{ recommended_module_versions };
 
 our $VERSION = 1.078;
 
-print "Generating tests that hide modules and then run other tests.\n";
+print "\n\nGenerating tests that hide modules and then run other tests.\n";
 
 my $this_program = __FILE__;
 
@@ -96,7 +96,7 @@ END_TEST_PROGRAM
     close $test_program;
 }
 
-print "Done.\n";
+print "Done.\n\n";
 
 __END__