| 1 | package Clustericious::Command::plackup; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Clustericious::Log; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Clustericious::App; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Mojo::Server::PSGI; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use base 'Clustericious::Command'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Which qw( which ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Mojo::URL; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # ABSTRACT: Clustericious command to start plack server | ||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '1.29'; # VERSION | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | __PACKAGE__->attr(description => <<EOT); | |||||||||||||||||||||||||||
| 17 | Start a plack server (see plackup) | ||||||||||||||||||||||||||||
| 18 | EOT | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | __PACKAGE__->attr(usage => <<EOT); | |||||||||||||||||||||||||||
| 21 | Usage $0: plackup [plackup options] | ||||||||||||||||||||||||||||
| 22 | Starts a plack server. See plackup for valid options. | ||||||||||||||||||||||||||||
| 23 | EOT | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 0 | my($self, @args) = @_; | |||||||||||||||||||||||||||
| 27 | 0 | my $app_name = $ENV{MOJO_APP}; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | $self->app->init_logging; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $plackup = which('plackup') || LOGDIE "could not find plackup in $ENV{PATH}"; | ||||||||||||||||||||||||||
|
Condition0%0/3
which('plackup') || LOGDIE("could not find plackup in $ENV{'PATH'}")
MC/DC0%0/2
which('plackup') || LOGDIE("could not find plackup in $ENV{'PATH'}")
which('plackup')
LOGDIE("could not find plackup in $ENV{'PATH'}")
Truth table0%0/3
A || B
A= which('plackup')B= LOGDIE("could not find plackup in $ENV{'PATH'}")
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | my $url = Mojo::URL->new($self->app->config->url); | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | LOGDIE "@{[ $url->scheme ]} not supported" if $url->scheme ne 'http'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | shift @args if defined $args[0] && $args[0] eq 'plackup'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $args[0] and $args[0] eq "plackup"
MC/DC0%0/2
defined $args[0] and $args[0] eq "plackup"
defined $args[0]
$args[0] eq "plackup"
Truth table0%0/3
A and B
A= defined $args[0]B= $args[0] eq "plackup"
| |||||||||||||||||||||||||||||
| 37 | 0 | push @args, $0; | |||||||||||||||||||||||||||
| 38 | 0 | unshift @args, '--port' => $url->port; | |||||||||||||||||||||||||||
| 39 | 0 | unshift @args, '--host' => $url->host; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | #if(my $pid_file = $self->app->config->plackup(default => {})->pid_file(default => 0)) | ||||||||||||||||||||||||||||
| 42 | #{ | ||||||||||||||||||||||||||||
| 43 | # unshift @args, '--pidfile' => $pid_file; | ||||||||||||||||||||||||||||
| 44 | #} | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | DEBUG "starting $plackup @args"; | |||||||||||||||||||||||||||
| 47 | 0 | delete $ENV{MOJO_COMMANDS_DONE}; | |||||||||||||||||||||||||||
| 48 | 0 | exec $plackup, @args; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | 1; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||