-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathWeb.pm
63 lines (52 loc) · 1.68 KB
/
Web.pm
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package MetaCPAN::Web;
use Moose;
use namespace::autoclean;
use Catalyst::Runtime 5.90042;
use Catalyst qw/
ConfigLoader
Authentication
/, '-Log=warn,error,fatal';
use Log::Log4perl::Catalyst ();
with 'MetaCPAN::Role::Fastly';
with 'MetaCPAN::Role::Fastly::Catalyst';
__PACKAGE__->request_class_traits( [ qw(
MetaCPAN::Web::Role::Request
Catalyst::TraitFor::Request::REST
) ] );
__PACKAGE__->response_class_traits( [ qw(
MetaCPAN::Web::Role::Response
) ] );
__PACKAGE__->config(
name => 'MetaCPAN::Web',
default_view => 'Xslate',
disable_component_resolution_regex_fallback => 1,
encoding => 'UTF-8',
'Plugin::Authentication' => {
use_session => 0,
default => {
class => '+MetaCPAN::Web::Authentication::Realm',
credential => {
class => 'NoPassword',
},
store => {
class => '+MetaCPAN::Web::Authentication::Store',
},
},
}
);
__PACKAGE__->log( Log::Log4perl::Catalyst->new( undef, autoflush => 1 ) );
# Squash warnings when not in a terminal (like when running under Docker)
# Catalyst throws warnings if it can't detect the size, even if $ENV{COLUMNS}
# exists. Just lie to it to shut it up.
use Term::Size::Perl ();
if ( !Term::Size::Perl::chars() ) {
no warnings 'once', 'redefine';
*Term::Size::Perl::chars = sub { $ENV{COLUMNS} || 80 };
}
after prepare_action => sub {
my ($self) = @_;
$self->req->final_args( $self->req->args );
};
__PACKAGE__->setup;
__PACKAGE__->meta->make_immutable;
1;