diff options
Diffstat (limited to 'new.psgi')
-rwxr-xr-x | new.psgi | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/new.psgi b/new.psgi deleted file mode 100755 index 9eb56b370..000000000 --- a/new.psgi +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env perl -use 5.10.1; -use strict; -use warnings; - -use File::Basename qw(basename dirname); -use File::Spec::Functions qw(catdir rel2abs); - -BEGIN { - require lib; - my $dir = rel2abs( dirname(__FILE__) ); - lib->import( $dir, catdir( $dir, 'lib' ), catdir( $dir, qw(local lib perl5) ) ); -} - -use Mojolicious::Lite; -use Bugzilla::Constants; -use Bugzilla::CGI::Mojo; -use Try::Tiny; - -plugin 'PODRenderer'; - -app->renderer->add_handler( - 'bugzilla' => sub { - my ( $renderer, $c, $output, $options ) = @_; - my %params; - - # Helpers - foreach my $method ( grep {m/^\w+\z/} keys %{ $renderer->helpers } ) { - my $sub = $renderer->helpers->{$method}; - $params{$method} = sub { $c->$sub(@_) }; - } - - # Stash values - $params{$_} = $c->stash->{$_} for grep {m/^\w+\z/} keys %{ $c->stash }; - $params{self} = $params{c} = $c; - Bugzilla->template->process( $options->{template}, \%params, $output ) - or die Bugzilla->template->error; - } -); - -app->hook( - around_dispatch => sub { - my ($next, $c) = @_; - try { - local %{ Bugzilla->request_cache } = (); - Bugzilla->usage_mode(USAGE_MODE_MOJO); - Bugzilla->cgi( Bugzilla::CGI::Mojo->new(controller => $c) ); - $next->(); - } catch { - die $_ unless /\bModPerl::Util::exit\b/; - }; - } -); - -get '/' => sub { - my $c = shift; - my $user = Bugzilla->login(LOGIN_OPTIONAL); - $c->stash->{use_login_page} = 1; - $c->render( template => 'index.html.tmpl', handler => 'bugzilla', user => $user ); -}; - -app->start; -__DATA__ - -@@ index.html.ep -% layout 'default'; -% title 'Welcome'; -% use Bugzilla::Util qw(remote_ip); - -<p>Hello, <%= $user->name %> <<%= $user->email %>> -</p> -<p>Your ip is <%= remote_ip() %> -</p> - -@@ layouts/default.html.ep -<!DOCTYPE html> -<html> - <head><title><%= title %></title></head> - <body><%= content %></body> -</html> |