[debhelper-devel] [debhelper] 02/03: dh_missing: Lazy load File::Find

Niels Thykier nthykier at moszumanska.debian.org
Sat Nov 11 11:10:35 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 bda9622d85a5f277cf4aa42b279a30e786bda504
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Nov 11 09:52:52 2017 +0000

    dh_missing: Lazy load File::Find
    
    We do not have a NOOP promise for dh_missing, but we can make it
    cheaper for single binary packages by lazy loading the File::Find
    module.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh_missing | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dh_missing b/dh_missing
index 68ccaee..1865806 100755
--- a/dh_missing
+++ b/dh_missing
@@ -8,7 +8,6 @@ dh_missing - check for missing files
 
 use strict;
 use warnings;
-use File::Find;
 use Debian::Debhelper::Dh_Lib;
 
 our $VERSION = DH_BUILTIN_VERSION;
@@ -142,7 +141,14 @@ my $installed=join("|", map {
 	"\Q$_\E\/.*|\Q$_\E";
 } @installed);
 $installed=qr{^($installed)$};
-find(sub {
+
+# Lazy load File::Find
+require File::Find;
+
+File::Find::find(sub {
+	# Lazy loading of File::Find makes perl think that File::Find::dir is only used once
+	# and we might have typo'ed something
+	no warnings qw(once);
 	-f || -l || return;
 	$_="$File::Find::dir/$_";
 	if (! /$installed/ && ! excludefile($_)) {

-- 
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