From 762dbb61c0deabc7fc6fdf379fa8a8e3d5fe044d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 24 Jan 2009 14:53:07 +1100 Subject: DOMTree: Fix perlcritic warnings Get rid of these: "return" statement with explicit "undef" at line 333, column 27. See page 199 of PBP. (Severity: 5) "return" statement with explicit "undef" at line 335, column 35. See page 199 of PBP. (Severity: 5) "return" statement with explicit "undef" at line 366, column 2. See page 199 of PBP. (Severity: 5) --- lib/Vyatta/ConfigDOMTree.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/Vyatta/ConfigDOMTree.pm b/lib/Vyatta/ConfigDOMTree.pm index 865f17b..d6f1ebe 100755 --- a/lib/Vyatta/ConfigDOMTree.pm +++ b/lib/Vyatta/ConfigDOMTree.pm @@ -330,11 +330,11 @@ sub _construct_dom_tree { my $subnodesNum=0; my $valuePresent=0; - if(!(defined $self)) {return undef;} + return unless defined $self; - opendir DIR, $self->{_dir} or return undef; - my @entries = grep !/^\./, readdir DIR; - closedir DIR; + opendir my $dir, $self->{_dir} or return; + my @entries = grep !/^\./, readdir $dir; + closedir $dir; while(@entries) { @@ -362,9 +362,7 @@ sub _construct_dom_tree { } } - if($valuePresent<1 && $subnodesNum<1) { - return undef; - } + return if ( $valuePresent < 1 && $subnodesNum < 1 ); return $self; } -- cgit v1.2.3