summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-07-23 17:20:47 +0200
committerDylan William Hardison <dylan@hardison.net>2018-07-31 18:57:17 +0200
commit0840339ee8a77fac943338f7ca354261c3d1066c (patch)
tree8bc7b2147a4ca5a057216049f61bb7f5867fc1e5
parent29c7ca6bb526ce2cc9eb99815b6fc1252b7870cf (diff)
downloadbugzilla-0840339ee8a77fac943338f7ca354261c3d1066c.tar.gz
bugzilla-0840339ee8a77fac943338f7ca354261c3d1066c.tar.xz
more tidy
-rw-r--r--Bugzilla/Quantum.pm1
-rw-r--r--Bugzilla/Quantum/Plugin/Glue.pm30
-rw-r--r--Bugzilla/Quantum/Static.pm4
-rw-r--r--Bugzilla/Quantum/Stdout.pm22
-rw-r--r--Bugzilla/Quantum/Template.pm39
5 files changed, 24 insertions, 72 deletions
diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm
index 1f6dce8da..083dcaf55 100644
--- a/Bugzilla/Quantum.pm
+++ b/Bugzilla/Quantum.pm
@@ -21,7 +21,6 @@ use Bugzilla::Logging;
use Bugzilla::Quantum::CGI;
use Bugzilla::Quantum::SES;
use Bugzilla::Quantum::Static;
-use Bugzilla::Quantum::Template;
use Bugzilla::Util ();
use Cwd qw(realpath);
use MojoX::Log::Log4perl::Tiny;
diff --git a/Bugzilla/Quantum/Plugin/Glue.pm b/Bugzilla/Quantum/Plugin/Glue.pm
index 4261d6729..f99026690 100644
--- a/Bugzilla/Quantum/Plugin/Glue.pm
+++ b/Bugzilla/Quantum/Plugin/Glue.pm
@@ -11,7 +11,6 @@ use Mojo::Base 'Mojolicious::Plugin';
use Try::Tiny;
use Bugzilla::Constants;
-use Bugzilla::Quantum::Template;
use Bugzilla::Logging;
use Bugzilla::RNG ();
use JSON::MaybeXS qw(decode_json);
@@ -20,10 +19,10 @@ sub register {
my ( $self, $app, $conf ) = @_;
my %D;
- if ($ENV{BUGZILLA_HTTPD_ARGS}) {
- my $args = decode_json($ENV{BUGZILLA_HTTPD_ARGS});
+ if ( $ENV{BUGZILLA_HTTPD_ARGS} ) {
+ my $args = decode_json( $ENV{BUGZILLA_HTTPD_ARGS} );
foreach my $arg (@$args) {
- if ($arg =~ /^-D(\w+)$/) {
+ if ( $arg =~ /^-D(\w+)$/ ) {
$D{$1} = 1;
}
else {
@@ -56,25 +55,25 @@ sub register {
$app->hook(
before_dispatch => sub {
my ($c) = @_;
- if ($D{HTTPD_IN_SUBDIR}) {
+ if ( $D{HTTPD_IN_SUBDIR} ) {
my $path = $c->req->url->path;
- if ($path =~ s{^/bmo}{}s) {
+ if ( $path =~ s{^/bmo}{}s ) {
$c->stash->{bmo_prefix} = 1;
$c->req->url->path($path);
}
}
- Log::Log4perl::MDC->put(request_id => $c->req->request_id);
+ Log::Log4perl::MDC->put( request_id => $c->req->request_id );
}
);
Bugzilla::Extension->load_all();
- if ($app->mode ne 'development') {
+ if ( $app->mode ne 'development' ) {
Bugzilla->preload_features();
DEBUG("preloading templates");
Bugzilla->preload_templates();
DEBUG("done preloading templates");
}
- $app->secrets([Bugzilla->localconfig->{side_wide_secret}]);
+ $app->secrets( [ Bugzilla->localconfig->{side_wide_secret} ] );
$app->renderer->add_handler(
'bugzilla' => sub {
@@ -92,23 +91,16 @@ sub register {
# The controller
$vars->{c} = $c;
my $name = $options->{template};
- unless ($name =~ /\./) {
+ unless ( $name =~ /\./ ) {
$name = sprintf '%s.%s.tmpl', $options->{template}, $options->{format};
}
my $template = Bugzilla->template;
$template->process( $name, $vars, $output )
- or die $template->error;
+ or die $template->error;
}
);
- $app->log(
- MojoX::Log::Log4perl::Tiny->new(
- logger => Log::Log4perl->get_logger(ref $app)
- )
- );
+ $app->log( MojoX::Log::Log4perl::Tiny->new( logger => Log::Log4perl->get_logger( ref $app ) ) );
}
-
-
-
1;
diff --git a/Bugzilla/Quantum/Static.pm b/Bugzilla/Quantum/Static.pm
index 2bb54990e..d687873ab 100644
--- a/Bugzilla/Quantum/Static.pm
+++ b/Bugzilla/Quantum/Static.pm
@@ -16,9 +16,9 @@ my $LEGACY_RE = qr{
}xs;
sub file {
- my ($self, $rel) = @_;
+ my ( $self, $rel ) = @_;
- if (my ($legacy_rel) = $rel =~ $LEGACY_RE) {
+ if ( my ($legacy_rel) = $rel =~ $LEGACY_RE ) {
local $self->{paths} = [ bz_locations->{cgi_path} ];
return $self->SUPER::file($legacy_rel);
}
diff --git a/Bugzilla/Quantum/Stdout.pm b/Bugzilla/Quantum/Stdout.pm
index 2cdba9160..699ec164a 100644
--- a/Bugzilla/Quantum/Stdout.pm
+++ b/Bugzilla/Quantum/Stdout.pm
@@ -22,35 +22,35 @@ has '_encoding' => (
default => '',
);
-sub TIEHANDLE { ## no critic (unpack)
+sub TIEHANDLE { ## no critic (unpack)
my $class = shift;
return $class->new(@_);
}
-sub PRINTF { ## no critic (unpack)
+sub PRINTF { ## no critic (unpack)
my $self = shift;
- $self->PRINT(sprintf @_);
+ $self->PRINT( sprintf @_ );
}
-sub PRINT { ## no critic (unpack)
- my $self = shift;
- my $c = $self->controller;
+sub PRINT { ## no critic (unpack)
+ my $self = shift;
+ my $c = $self->controller;
my $bytes = join '', @_;
return unless $bytes;
- if ($self->_encoding) {
- $bytes = encode($self->_encoding, $bytes);
+ if ( $self->_encoding ) {
+ $bytes = encode( $self->_encoding, $bytes );
}
$c->write($bytes);
}
sub BINMODE {
- my ($self, $mode) = @_;
+ my ( $self, $mode ) = @_;
if ($mode) {
- if ($mode eq ':bytes' or $mode eq ':raw') {
+ if ( $mode eq ':bytes' or $mode eq ':raw' ) {
$self->_encoding('');
}
- elsif ($mode eq ':utf8') {
+ elsif ( $mode eq ':utf8' ) {
$self->_encoding('utf8');
}
}
diff --git a/Bugzilla/Quantum/Template.pm b/Bugzilla/Quantum/Template.pm
deleted file mode 100644
index 2442f1134..000000000
--- a/Bugzilla/Quantum/Template.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
-
-package Bugzilla::Quantum::Template;
-use 5.10.1;
-use Moo;
-
-has 'controller' => (
- is => 'ro',
- required => 1,
-);
-
-has 'template' => (
- is => 'ro',
- required => 1,
- handles => ['error', 'get_format'],
-);
-
-sub process {
- my ($self, $file, $vars, $output) = @_;
-
- if (@_ < 4) {
- $self->controller->stash->{vars} = $vars;
- $self->controller->render(template => $file, handler => 'bugzilla');
- return 1;
- }
- elsif (@_ == 4) {
- return $self->template->process($file, $vars, $output);
- }
- else {
- die __PACKAGE__ . '->process() called with too many arguments';
- }
-}
-
-1; \ No newline at end of file