diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-10-09 23:01:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-09 23:01:07 +0200 |
commit | 75dbfe1dc03748957f07eca5ac583bedc6fdba76 (patch) | |
tree | 692f90aa15f4e512581cf2cf06a9b240757aaaba /Bugzilla/DB | |
parent | 2ae37c378b50b1ae16c35ce74999b19eb91af07d (diff) | |
download | bugzilla-75dbfe1dc03748957f07eca5ac583bedc6fdba76.tar.gz bugzilla-75dbfe1dc03748957f07eca5ac583bedc6fdba76.tar.xz |
Bug 623384 - Use Module::Runtime instead of eval { require } or eval "use"
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Schema.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 67ee9071c..e1c19fa51 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -28,6 +28,8 @@ use Carp qw(confess); use Digest::MD5 qw(md5_hex); use Hash::Util qw(lock_value unlock_hash lock_keys unlock_keys); use List::MoreUtils qw(firstidx natatime); +use Try::Tiny; +use Module::Runtime qw(require_module); use Safe; # Historical, needed for SCHEMA_VERSION = '1.00' use Storable qw(dclone freeze thaw); @@ -1876,9 +1878,12 @@ sub new { if ($driver) { (my $subclass = $driver) =~ s/^(\S)/\U$1/; $class .= '::' . $subclass; - eval "require $class;"; - die "The $class class could not be found ($subclass " . - "not supported?): $@" if ($@); + try { + require_module($class); + } + catch { + die "The $class class could not be found ($subclass not supported?): $_"; + }; } die "$class is an abstract base class. Instantiate a subclass instead." if ($class eq __PACKAGE__); |