summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/User/Setting.pm8
-rw-r--r--Bugzilla/WebService/Server/REST.pm8
2 files changed, 9 insertions, 7 deletions
diff --git a/Bugzilla/User/Setting.pm b/Bugzilla/User/Setting.pm
index a0b079ec7..ac53fbb32 100644
--- a/Bugzilla/User/Setting.pm
+++ b/Bugzilla/User/Setting.pm
@@ -13,8 +13,6 @@ use strict;
use warnings;
use base qw(Exporter);
-
-
# Module stuff
@Bugzilla::User::Setting::EXPORT = qw(
get_all_settings
@@ -25,6 +23,7 @@ use base qw(Exporter);
use Bugzilla::Error;
use Bugzilla::Util qw(trick_taint get_text);
+use Module::Runtime qw(require_module);
###############################
### Module Initialization ###
@@ -104,9 +103,8 @@ sub new {
$self->{'category'} = shift;
}
if ($subclass) {
- eval('require ' . $class . '::' . $subclass);
- $@ && ThrowCodeError('setting_subclass_invalid',
- {'subclass' => $subclass});
+ eval { require_module( $class . '::' . $subclass ) }
+ || ThrowCodeError( 'setting_subclass_invalid', { 'subclass' => $subclass } );
$class = $class . '::' . $subclass;
}
bless($self, $class);
diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm
index b8884b753..13896b248 100644
--- a/Bugzilla/WebService/Server/REST.pm
+++ b/Bugzilla/WebService/Server/REST.pm
@@ -34,6 +34,7 @@ use Bugzilla::WebService::Server::REST::Resources::Elastic;
use List::MoreUtils qw(uniq);
use Scalar::Util qw(blessed reftype);
use MIME::Base64 qw(decode_base64);
+use Module::Runtime qw(require_module);
###########################
# Public Method Overrides #
@@ -392,6 +393,10 @@ sub _retrieve_json_params {
return $params;
}
+sub preload {
+ require_module($_) for values %{ WS_DISPATCH() };
+}
+
sub _find_resource {
my ($self, $path) = @_;
@@ -399,13 +404,12 @@ sub _find_resource {
# $module->rest_resources to get the resources array ref.
my $resources = {};
foreach my $module (values %{ $self->{dispatch_path} }) {
- eval("require $module") || die $@;
next if !$module->can('rest_resources');
$resources->{$module} = $module->rest_resources;
}
Bugzilla::Hook::process('webservice_rest_resources',
- { rpc => $self, resources => $resources });
+ { rpc => $self, resources => $resources }) if Bugzilla::request_cache->{bzapi};
# Use the resources hash from each module loaded earlier to determine
# which handler to use based on a regex match of the CGI path.