summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Util.pm
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-11-21 08:37:26 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2011-11-21 08:37:26 +0100
commita4528b84c02ebb1d7b9bff1f068283e28c5186de (patch)
treeb37028daa37a9befa3eb97e5feed945476a56c3b /Bugzilla/Util.pm
parentedaf6506a009280be2e3b894b5563609b9ff734d (diff)
downloadbugzilla-a4528b84c02ebb1d7b9bff1f068283e28c5186de.tar.gz
bugzilla-a4528b84c02ebb1d7b9bff1f068283e28c5186de.tar.xz
Bug 703928: Bugzilla::Util should depend on Bugzilla::Error, not the opposite
r=dkl a=LpSolit
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r--Bugzilla/Util.pm26
1 files changed, 10 insertions, 16 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index a3ec2aafe..c0bb5630c 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -47,6 +47,7 @@ use base qw(Exporter);
use Bugzilla::Constants;
use Bugzilla::RNG qw(irand);
+use Bugzilla::Error;
use Date::Parse;
use Date::Format;
@@ -639,10 +640,9 @@ sub get_text {
$vars ||= {};
$vars->{'message'} = $name;
my $message;
- if (!$template->process('global/message.txt.tmpl', $vars, \$message)) {
- require Bugzilla::Error;
- Bugzilla::Error::ThrowTemplateError($template->error());
- }
+ $template->process('global/message.txt.tmpl', $vars, \$message)
+ || ThrowTemplateError($template->error());
+
# Remove the indenting that exists in messages.html.tmpl.
$message =~ s/^ //gm;
return $message;
@@ -657,13 +657,10 @@ sub template_var {
my %vars;
# Note: If we suddenly start needing a lot of template_var variables,
# they should move into their own template, not field-descs.
- my $result = $template->process('global/field-descs.none.tmpl',
- { vars => \%vars, in_template_var => 1 });
- # Bugzilla::Error can't be "use"d in Bugzilla::Util.
- if (!$result) {
- require Bugzilla::Error;
- Bugzilla::Error::ThrowTemplateError($template->error);
- }
+ $template->process('global/field-descs.none.tmpl',
+ { vars => \%vars, in_template_var => 1 })
+ || ThrowTemplateError($template->error());
+
$cache->{$lang} = \%vars;
return $vars{$name};
}
@@ -688,11 +685,8 @@ use constant UTF8_ACCIDENTAL => qw(shiftjis big5-eten euc-kr euc-jp);
sub detect_encoding {
my $data = shift;
- if (!Bugzilla->feature('detect_charset')) {
- require Bugzilla::Error;
- Bugzilla::Error::ThrowCodeError('feature_disabled',
- { feature => 'detect_charset' });
- }
+ Bugzilla->feature('detect_charset')
+ || ThrowCodeError('feature_disabled', { feature => 'detect_charset' });
require Encode::Detect::Detector;
import Encode::Detect::Detector 'detect';