[debhelper-devel] [debhelper] 01/01: Replace some string evals with a simple require

Niels Thykier nthykier at moszumanska.debian.org
Sat Nov 11 08:09:43 UTC 2017


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 0ff7d9c44b153c5536cb43a71a34bc35154b026b
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Nov 11 08:08:29 2017 +0000

    Replace some string evals with a simple require
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh                             | 2 +-
 lib/Debian/Debhelper/Dh_Lib.pm | 8 ++++----
 t/pod.t                        | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dh b/dh
index d492f28..3d26826 100755
--- a/dh
+++ b/dh
@@ -540,7 +540,7 @@ sub list_addons {
 	my %addons;
 
 	for my $inc (@INC) {
-		eval q{use File::Spec};
+		require File::Spec;
 		my $path = File::Spec->catdir($inc, "Debian/Debhelper/Sequence");
 		if (-d $path) {
 			for my $module_path (glob "$path/*.pm") {
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 8f605a7..04e94a6 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -113,7 +113,7 @@ sub init {
 	if ((defined $ENV{DH_OPTIONS} && length $ENV{DH_OPTIONS}) ||
  	    (defined $ENV{DH_INTERNAL_OPTIONS} && length $ENV{DH_INTERNAL_OPTIONS}) ||
 	    grep /^-/, @ARGV) {
-		eval "use Debian::Debhelper::Dh_Getopt";
+		eval { require Debian::Debhelper::Dh_Getopt; };
 		error($@) if $@;
 		Debian::Debhelper::Dh_Getopt::parseopts(%params);
 	}
@@ -1798,12 +1798,12 @@ sub cross_command {
 # variable and returns the computed value.
 sub get_source_date_epoch {
 	return $ENV{SOURCE_DATE_EPOCH} if exists($ENV{SOURCE_DATE_EPOCH});
-	eval "use Dpkg::Changelog::Debian";
+	eval { require Dpkg::Changelog::Debian };
 	if ($@) {
 		warning "unable to set SOURCE_DATE_EPOCH: $@";
 		return;
 	}
-	eval "use Time::Piece";
+	eval { require Time::Piece };
 	if ($@) {
 		warning "unable to set SOURCE_DATE_EPOCH: $@";
 		return;
@@ -1835,7 +1835,7 @@ sub set_buildflags {
 	# rely on this [CVE-2016-1238]
 	$ENV{PERL_USE_UNSAFE_INC} = 1 if compat(10);
 
-	eval "use Dpkg::BuildFlags";
+	eval { require Dpkg::BuildFlags };
 	if ($@) {
 		warning "unable to load build flags: $@";
 		return;
diff --git a/t/pod.t b/t/pod.t
index 755fb81..444eed2 100755
--- a/t/pod.t
+++ b/t/pod.t
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Test::More;
 
-eval 'use Test::Pod';
+eval { require Test::Pod; Test::Pod->import; };
 plan skip_all => 'Test::Pod required' if $@;
 
 all_pod_files_ok('debhelper.pod', grep { -x $_ } 'dh', glob 'dh_*');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list