Created
May 6, 2012 04:32
-
-
Save Cside/2613110 to your computer and use it in GitHub Desktop.
plackup without default middlewares
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $runner = Plack::Runner::WithoutDefaultMiddleware->new; | |
$runner->parse_options(@ARGV); | |
$runner->run; | |
package Plack::Runner::WithoutDefaultMiddleware; | |
use base 'Plack::Runner'; | |
sub prepare_devel { | |
my($self, $app) = @_; | |
push @{$self->{options}}, server_ready => sub { | |
my($args) = @_; | |
my $name = $args->{server_software} || ref($args); # $args is $server | |
my $host = $args->{host} || 0; | |
my $proto = $args->{proto} || 'http'; | |
print STDERR "$name: Accepting connections at $proto://$host:$args->{port}/\n"; | |
}; | |
$app; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment