headerdep: perlcritic warning

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, June 1, 2010 - 10:00 am

Gitweb:     http://git.kernel.org/linus/1dcd81002453f9f22c6c4fd6c3c7d8f1c7c891fa
Commit:     1dcd81002453f9f22c6c4fd6c3c7d8f1c7c891fa
Parent:     2d74b2c62cf8867d0762f6e6b5ed8906cb6a745f
Author:     Stephen Hemminger <shemminger@vyatta.com>
AuthorDate: Mon Mar 8 08:24:27 2010 -0800
Committer:  Michal Marek <mmarek@suse.cz>
CommitDate: Tue Mar 23 12:26:38 2010 +0100

    headerdep: perlcritic warning
    
    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 |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/scripts/headerdep.pl b/scripts/headerdep.pl
index b7f6c56..8dd019b 100755
--- a/scripts/headerdep.pl
+++ b/scripts/headerdep.pl
@@ -80,8 +80,7 @@ sub search {
 		my $path = "$i/$filename";
 		return $path if -f $path;
 	}
-
-	return undef;
+	return;
 }
 
 sub parse_all {
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
headerdep: perlcritic warning, Linux Kernel Mailing ..., (Tue Jun 1, 10:00 am)