]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
headerdep: perlcritic warning
authorStephen Hemminger <shemminger@vyatta.com>
Mon, 8 Mar 2010 16:24:27 +0000 (08:24 -0800)
committerMichal Marek <mmarek@suse.cz>
Tue, 23 Mar 2010 11:26:38 +0000 (12:26 +0100)
Minor perlcritic warning:
headerdep.pl: "return" statement with explicit "undef" at line 84, column 2.  See page 199 of PBP.  (Severity: 5)

The rationale according to PBP is that an explicit return of undef
(contrary to most people's expectations) doesn't
always evaluate as false. It has to with the fact that perl return value
depends on context the function is called. If function is used in
list context, the appropriate return value for false is an empty list;
whereas in scalar context the return value for false is undefined.
By just using a "return" both cases are handled.

In the context of a trivial script this doesn't matter. But one script
may be cut-paste into later code (most people like me only know 50%
of perl), that is why perlcritic always complains

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/headerdep.pl

index b7f6c560e24d2e88aabb36aea8272465eb94936c..8dd019bc5a7361631c71dc1d5e33095b6f42b6a1 100755 (executable)
@@ -80,8 +80,7 @@ sub search {
                my $path = "$i/$filename";
                return $path if -f $path;
        }
-
-       return undef;
+       return;
 }
 
 sub parse_all {