[libconfig-model-dpkg-perl] 15/24: check_perl_lib_dep: use return in middle of sub to avoid nesting

dod at debian.org dod at debian.org
Sun Apr 20 13:07:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.

commit 7c67fa577b698a0218aa7f7f7ffa721f1d2c6685
Author: Dominique Dumont <dod at debian.org>
Date:   Thu Apr 17 19:42:10 2014 +0200

    check_perl_lib_dep: use return in middle of sub to avoid nesting
---
 lib/Config/Model/Dpkg/Dependency.pm | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index bec6725..5bf2ce5 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -565,20 +565,20 @@ sub check_perl_lib_dep {
 		version->parse( $cpan_dep_v )
 	);
 
-	if (defined $v_decimal) {
-		$v_normal = version->new($v_decimal)->normal;
-		$v_normal =~ s/^v//;    # loose the v prefix
-		if ( $logger->is_debug ) {
-			my $dep_str = $dep_name . ( defined $check_v ? ' ' . $check_v : '' );
-			$logger->debug("dual life $dep_str aka $dep_name_as_perl[0] found in Perl core $v_normal");
-		}
+	return $ret unless defined $v_decimal;
 
-		my @res = $self->check_versioned_dep(  ['perl', '>=', $v_normal] );
-        my $has_older_perl = $res[0] ;
-        push @ideal_perl_dep, '>=', $v_normal if $has_older_perl;
-        $check_perl_lib->($has_older_perl) ;
+	$v_normal = version->new($v_decimal)->normal;
+	$v_normal =~ s/^v//;    # loose the v prefix
+	if ( $logger->is_debug ) {
+		my $dep_str = $dep_name . ( defined $check_v ? ' ' . $check_v : '' );
+		$logger->debug("dual life $dep_str aka $dep_name_as_perl[0] found in Perl core $v_normal");
 	}
 
+	@res = $self->check_versioned_dep(  ['perl', '>=', $v_normal] );
+	my $has_older_perl = $res[0] ;
+	push @ideal_perl_dep, '>=', $v_normal if $has_older_perl;
+	$check_perl_lib->($has_older_perl) ;
+
     return $ret ;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git



More information about the Pkg-perl-cvs-commits mailing list