diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-02-04 10:51:58 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-02-04 10:51:58 -0800 |
commit | eb17b185a339fb73059899f5a0bcbac987745002 (patch) | |
tree | fed7fc50768720e8f2747f6f43470148893c0b21 /lib/Vyatta | |
parent | eaf4e68ae42b1e4e5c4f5ca0ea944c0ab383157b (diff) | |
download | vyatta-cfg-eb17b185a339fb73059899f5a0bcbac987745002.tar.gz vyatta-cfg-eb17b185a339fb73059899f5a0bcbac987745002.zip |
Vyatta::Config - fix perlcritic warnings from dangling return
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/Config.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm index 77fb440..d253236 100755 --- a/lib/Vyatta/Config.pm +++ b/lib/Vyatta/Config.pm @@ -473,16 +473,17 @@ sub getTmplPath { next; } # the path is not valid! - return undef; + return; } - return $tpath + return $tpath; } sub isTagNode { my $self = shift; my $cfg_path_ref = shift; my $tpath = $self->getTmplPath($cfg_path_ref); - return undef if (!defined($tpath)); + return unless $tpath; + if (-d "$tpath/node.tag") { return 1; } @@ -493,7 +494,8 @@ sub hasTmplChildren { my $self = shift; my $cfg_path_ref = shift; my $tpath = $self->getTmplPath($cfg_path_ref); - return undef if (!defined($tpath)); + return unless $tpath; + opendir(TDIR, $tpath) or return 0; my @tchildren = grep !/^node\.def$/, (grep !/^\./, (readdir TDIR)); closedir TDIR; @@ -511,7 +513,8 @@ sub parseTmpl { my $cfg_path_ref = shift; my ($is_multi, $is_text, $default) = (0, 0, undef); my $tpath = $self->getTmplPath($cfg_path_ref); - return undef if (!defined($tpath)); + return unless $tpath; + if (! -r "$tpath/node.def") { return ($is_multi, $is_text); } |