root/lang/perl/mobirc/trunk/lib/App/Mobirc/Plugin/Component/HTTPD.pm @ 18451

Revision 18451, 1.0 kB (checked in by tokuhirom, 5 years ago)

make immutable

Line 
1package App::Mobirc::Plugin::Component::HTTPD;
2use strict;
3use MooseX::Plaggerize::Plugin;
4
5use App::Mobirc;
6use App::Mobirc::Util;
7use App::Mobirc::Web::Handler;
8
9use HTTP::Engine;
10use App::Mobirc::Web::Middleware::Encoding;
11use App::Mobirc::Web::Middleware::MobileAgent;
12
13has address => (
14    is      => 'ro',
15    isa     => 'Str',
16    default => '0.0.0.0',
17);
18
19has port => (
20    is      => 'ro',
21    isa     => 'Int',
22    default => 80,
23);
24
25hook run_component => sub {
26    my ( $self, $global_context ) = @_;
27
28    HTTP::Engine->new(
29        interface => {
30            module => 'POE',
31            args   => {
32                host  => $self->address,
33                port  => $self->port,
34                alias => 'mobirc_httpd',
35            },
36            request_handler => App::Mobirc::Web::Middleware::Encoding->wrap( \&App::Mobirc::Web::Handler::handler ),
37        }
38    )->run;
39
40    # default plugins
41    $global_context->load_plugin('StickyTime');
42};
43
44no Moose; __PACKAGE__->meta->make_immutable;
451;
Note: See TracBrowser for help on using the browser.