From 1dcd81002453f9f22c6c4fd6c3c7d8f1c7c891fa Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 8 Mar 2010 08:24:27 -0800 Subject: 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 Signed-off-by: Michal Marek --- scripts/headerdep.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'scripts/headerdep.pl') diff --git a/scripts/headerdep.pl b/scripts/headerdep.pl index b7f6c560e24..8dd019bc5a7 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 { -- cgit v1.2.3-70-g09d2