Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Display banner on startup #3

  • Loading branch information...
commit c9904f02acfa843be7ea881ea998f5be1fdb5ec3 1 parent ed2ddcb
@miyagawa authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 lib/Plack/Handler/Corona.pm
View
20 lib/Plack/Handler/Corona.pm
@@ -1,6 +1,21 @@
+package Plack::Handler::Corona::Server;
+use strict;
+use base 'Corona::Server';
+
+sub pre_loop_hook {
+ my $self = shift;
+ $self->SUPER::pre_loop_hook(@_);
+
+ my $s = $self->{server};
+ $s->{_server_ready}->({
+ host => $s->{host}[0],
+ port => $s->{port}[0],
+ server_software => 'Corona',
+ });
+}
+
package Plack::Handler::Corona;
use strict;
-use Corona::Server;
sub new {
my $class = shift;
@@ -10,11 +25,12 @@ sub new {
sub run {
my($self, $app) = @_;
- my $server = Corona::Server->new(
+ my $server = Plack::Handler::Corona::Server->new(
host => $self->{host} || '*',
user => $self->{user} || $>,
group => $self->{group} || $),
log_level => 1,
+ _server_ready => $self->{server_ready} || sub {},
);
$server->{app} = $app;
$server->run(port => $self->{port});
Please sign in to comment.
Something went wrong with that request. Please try again.