diff --git a/extensions/QA/Config.pm b/extensions/QA/Config.pm index 87726a5..59799ec 100644 --- a/extensions/QA/Config.pm +++ b/extensions/QA/Config.pm @@ -7,7 +7,6 @@ package Bugzilla::Extension::QA; -use 5.10.1; use strict; use constant NAME => 'QA'; @@ -18,4 +17,4 @@ use constant REQUIRED_MODULES => [ use constant OPTIONAL_MODULES => [ ]; -__PACKAGE__->NAME; \ No newline at end of file +__PACKAGE__->NAME; diff --git a/extensions/QA/Extension.pm b/extensions/QA/Extension.pm index 58edc30..b5f404d 100644 --- a/extensions/QA/Extension.pm +++ b/extensions/QA/Extension.pm @@ -7,9 +7,8 @@ package Bugzilla::Extension::QA; -use 5.10.1; use strict; -use parent qw(Bugzilla::Extension); +use base qw(Bugzilla::Extension); use Bugzilla::Extension::QA::Util; use Bugzilla::Constants; @@ -36,22 +35,20 @@ sub page_before_template { my $action = $cgi->param('action') || ''; my $vars = { sender => $user, action => $action, pid => $$ }; - given ($action) { - when ('create') { - $tmpl_file = 'qa/create_bug.txt.tmpl'; - } - when ('create_with_headers') { - $tmpl_file = 'qa/create_bug_with_headers.txt.tmpl'; - } - when (/^update(_with_headers)?$/) { - my $f = $1 // ''; - $tmpl_file = "qa/update_bug$f.txt.tmpl"; - my $bug = Bugzilla::Bug->check($cgi->param('bug_id')); - $vars->{bug_id} = $bug->id; - } - default { - ThrowUserError('unknown_action', { action => $action }); - } + if ($action eq 'create') { + $tmpl_file = 'qa/create_bug.txt.tmpl'; + } + elsif ($action eq 'create_with_headers') { + $tmpl_file = 'qa/create_bug_with_headers.txt.tmpl'; + } + elsif ($action =~ /^update(_with_headers)?$/) { + my $f = $1 || ''; + $tmpl_file = "qa/update_bug$f.txt.tmpl"; + my $bug = Bugzilla::Bug->check($cgi->param('bug_id')); + $vars->{bug_id} = $bug->id; + } + else { + ThrowUserError('unknown_action', { action => $action }); } $template->process($tmpl_file, $vars, \$output) @@ -71,4 +68,4 @@ sub page_before_template { or ThrowTemplateError($template->error()); } -__PACKAGE__->NAME; \ No newline at end of file +__PACKAGE__->NAME; diff --git a/extensions/QA/lib/Util.pm b/extensions/QA/lib/Util.pm index a4fd63f..9bc2d8d 100644 --- a/extensions/QA/lib/Util.pm +++ b/extensions/QA/lib/Util.pm @@ -7,9 +7,8 @@ package Bugzilla::Extension::QA::Util; -use 5.10.1; use strict; -use parent qw(Exporter); +use base qw(Exporter); our @EXPORT = qw( parse_output @@ -20,7 +19,7 @@ sub parse_output { $vars->{error} = ($output =~ /software error/i) ? 1 : 0; $vars->{output} = $output; - $vars->{bug_id} //= ($output =~ /Created bug (\d+)/i) ? $1 : undef; + $vars->{bug_id} ||= ($output =~ /Created bug (\d+)/i) ? $1 : undef; } -1; \ No newline at end of file +1;