Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 76 lines (59 sloc) 1.7 KB
#!/usr/bin/env perl
use warnings;
use strict;
use EV ();
use Feersum ();
require Getopt::Long;
my $native = 0;
Getopt::Long::Configure("no_ignore_case", "no_auto_abbrev", "pass_through");
Getopt::Long::GetOptions(
"native!" => \$native,
);
my $runner;
if ($native) {
my $listen = 'localhost:5000';
my $pre_fork = 0;
my $verbose = 0;
Getopt::Long::GetOptions(
"listen=s" => \$listen,
"pre-fork=i" => \$pre_fork,
"verbose!" => \$verbose,
);
require Feersum::Runner;
my $app_file = pop @ARGV || 'app.feersum';
$runner = Feersum::Runner->new(
'listen' => [$listen],
app_file => $app_file,
pre_fork => $pre_fork,
quiet => !$verbose,
);
}
else {
my @args = (
server => 'Feersum',
env => 'deployment',
version_cb => sub {
print "Feersum $Feersum::VERSION on EV $EV::VERSION\n";
}
);
require Plack::Runner;
$runner = Plack::Runner->new(@args);
$runner->parse_options(@ARGV);
}
$runner->run;
__END__
=head1 NAME
feersum - feersum app loader
=head1 SYNOPSIS
feersum [plackup opts] [--pre-fork=N] [app.psgi]
feersum --native [--listen host:port] [--pre-fork=N] [app.feersum]
=head1 DESCRIPTION
Loads the specified app file into a Feersum server.
In both cases, if C<--pre-fork=N> is specified, that many worker processes are
used to serve requests. See L<Feersum::Runner> for details.
If in native mode (when running C<feersum --native>), currently only a
C<--listen> parameter is accepted. By default, the server will listen on
localhost port 5000.
When running in PSGI mode (non-native), L<Plack::Runner> is used. See that
module for documentation and defaults.
=cut