Skip to content

Commit

Permalink
Bugzilla 4.4 still has to support Perl 5.8.x :(
Browse files Browse the repository at this point in the history
  • Loading branch information
LpSolit committed Oct 19, 2013
1 parent ed5dee7 commit 8caecc9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
3 changes: 1 addition & 2 deletions extensions/QA/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package Bugzilla::Extension::QA;

use 5.10.1;
use strict;

use constant NAME => 'QA';
Expand All @@ -18,4 +17,4 @@ use constant REQUIRED_MODULES => [
use constant OPTIONAL_MODULES => [
];

__PACKAGE__->NAME;
__PACKAGE__->NAME;
35 changes: 16 additions & 19 deletions extensions/QA/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -71,4 +68,4 @@ sub page_before_template {
or ThrowTemplateError($template->error());
}

__PACKAGE__->NAME;
__PACKAGE__->NAME;
7 changes: 3 additions & 4 deletions extensions/QA/lib/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
1;

0 comments on commit 8caecc9

Please sign in to comment.