summaryrefslogtreecommitdiff
path: root/dh_missing
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2017-11-11 09:52:52 +0000
committerNiels Thykier <niels@thykier.net>2017-11-11 09:52:54 +0000
commitbda9622d85a5f277cf4aa42b279a30e786bda504 (patch)
tree733358ef8ffad8e3257d92d8118f7c443b77fe49 /dh_missing
parentd2ace56b996b54d8ba24fcd9af3206d3839cbe57 (diff)
downloaddebhelper-bda9622d85a5f277cf4aa42b279a30e786bda504.tar.gz
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@thykier.net>
Diffstat (limited to 'dh_missing')
-rwxr-xr-xdh_missing10
1 files changed, 8 insertions, 2 deletions
diff --git a/dh_missing b/dh_missing
index 68ccaee6..1865806e 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($_)) {