| 1 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | package Ubic::Service::Starman; | ||||||||||
| 4 | { | ||||||||||
| 5 | 2 | $Ubic::Service::Starman::VERSION = '0.004'; | |||||||||
| 6 | } | ||||||||||
| 7 | |||||||||||
| 8 | # Set the plackup bin to starman | ||||||||||
| 9 | 2 | ▶ | sub BEGIN { $ENV{'UBIC_SERVICE_PLACKUP_BIN'} = 'starman'; } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | use base qw(Ubic::Service::Plack); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | # ABSTRACT: Helper for running psgi applications with Starman | ||||||||||
| 14 | |||||||||||
| 15 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 16 | 2 | my $class = shift; | |||||||||
| 17 | 2 | ▶ | my $args = @_ > 1 ? { @_ } : $_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | |||||||||||
| 19 | 2 | $args->{server} = 'Starman'; | |||||||||
| 20 | 2 | my $obj = $class->SUPER::new( $args ); | |||||||||
| 21 | # Default pid file for starman | ||||||||||
| 22 | 2 | ▶ | unless( $obj->{server_args}->{pid} ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | # Set a pid for the starman server if one is not already set, | ||||||||||
| 24 | # we'll need it for the reload command to work | ||||||||||
| 25 | 2 | $obj->{server_args}->{pid} = $obj->pidfile . '.starman'; | |||||||||
| 26 | } | ||||||||||
| 27 | 2 | return $obj; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub reload { | ||||||||
|
Subroutine
reload: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 31 | 0 | my ( $self ) = @_; | |||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | open FILE, $self->{server_args}->{pid} or die "Couldn't read pidfile"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | chomp(my $pid = <FILE>); | |||||||||
| 35 | |||||||||||
| 36 | 0 | kill HUP => $pid; | |||||||||
| 37 | 0 | return 'reloaded'; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | 2 | 1; | |||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||