diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm
index 1ee7aca673d4eecce6851469c8c2488f57dc6676..2f1a8d527d8da92d00b3ca6d0a7c98e4239e692b 100644
--- a/Bugzilla/Install/Localconfig.pm
+++ b/Bugzilla/Install/Localconfig.pm
@@ -36,7 +36,6 @@ use Bugzilla::Util qw(generate_random_password);
 
 use Data::Dumper;
 use File::Basename qw(dirname);
-use IO::File;
 use Safe;
 
 use base qw(Exporter);
diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm
index bd8942507d50c839b7b57d268f08b93bf12d74c6..43433eb9674c1f528e68aa6f91c903afa4a7a07c 100644
--- a/Bugzilla/Install/Util.pm
+++ b/Bugzilla/Install/Util.pm
@@ -29,11 +29,9 @@ use strict;
 use Bugzilla::Constants;
 
 use Encode;
-use ExtUtils::MM ();
 use File::Basename;
 use File::Spec;
 use POSIX qw(setlocale LC_CTYPE);
-use Safe;
 use Scalar::Util qw(tainted);
 use Term::ANSIColor qw(colored);
 use PerlIO;
@@ -58,6 +56,9 @@ our @EXPORT_OK = qw(
 
 sub bin_loc {
     my ($bin, $path) = @_;
+    # This module is not needed most of the time and is a bit slow,
+    # so we only load it when calling bin_loc().
+    require ExtUtils::MM;
 
     # If the binary is a full path...
     if ($bin =~ m{[/\\]}) {
@@ -541,7 +542,10 @@ sub no_checksetup_from_cgi {
 # Used by install_string
 sub _get_string_from_file {
     my ($string_id, $file) = @_;
-    
+    # This module is only needed by checksetup.pl,
+    # so only load it when needed.
+    require Safe;
+
     return undef if !-e $file;
     my $safe = new Safe;
     $safe->rdo($file);
diff --git a/Bugzilla/RNG.pm b/Bugzilla/RNG.pm
index caa63bae2aa188e03d6932bf9bb19f0af9bfe169..9ee6d49e5158d4e8a62206c4f5483cea9a2d62e5 100644
--- a/Bugzilla/RNG.pm
+++ b/Bugzilla/RNG.pm
@@ -24,7 +24,6 @@ use strict;
 use base qw(Exporter);
 use Bugzilla::Constants qw(ON_WINDOWS);
 
-use IO::File;
 use Math::Random::ISAAC;
 use if ON_WINDOWS, 'Win32::API';
 
@@ -156,14 +155,14 @@ sub _get_seed {
 sub _read_seed_from {
     my ($from) = @_;
 
-    my $fh = IO::File->new($from, "r") or die "$from: $!";
+    open(my $fh, '<', $from) or die "$from: $!";
     my $buffer;
-    $fh->read($buffer, SEED_SIZE);
+    read($fh, $buffer, SEED_SIZE);
     if (length($buffer) < SEED_SIZE) {
         die "Could not read enough seed bytes from $from, got only " 
             . length($buffer);
     }
-    $fh->close;
+    close $fh;
     return $buffer;
 }