1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package MyappPL;
use Mojo::Base 'Mojolicious';
# This method will run once at server start
sub startup {
my $self = shift;
# ここから
if ($self->log->is_level('debug')) {
no warnings 'redefine';
*Mojo::Log::format = sub {
my ($self, $level, @lines) = @_;
my @caller = caller(4);
my $caller = join ' ', $caller[0], $caller[2];
return
'['
. localtime(time)
. "] [$level] [$caller] "
. join("\n", @lines) . "\n";
};
}
# ここまで追加
# Documentation browser under "/perldoc"
$self->plugin('PODRenderer');
# Router
my $r = $self->routes;
# Normal route to controller
$r->get('/')->to('example#welcome');
}
1;
|