File Coverage

blib/lib/Ubic/Service/Starman.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 14 100.0


line stmt bran cond sub pod time code
1 1     1   28788 use strict;
  1         2  
  1         46  
2 1     1   6 use warnings;
  1         2  
  1         77  
3             package Ubic::Service::Starman;
4             {
5             $Ubic::Service::Starman::VERSION = '0.004';
6             }
7              
8             # Set the plackup bin to starman
9 1     1   37 sub BEGIN { $ENV{'UBIC_SERVICE_PLACKUP_BIN'} = 'starman'; }
10              
11 1     1   6 use base qw(Ubic::Service::Plack);
  1         2  
  1         2430  
12              
13             # ABSTRACT: Helper for running psgi applications with Starman
14              
15             sub new {
16             my $class = shift;
17             my $args = @_ > 1 ? { @_ } : $_[0];
18              
19             $args->{server} = 'Starman';
20             my $obj = $class->SUPER::new( $args );
21             # Default pid file for starman
22             unless( $obj->{server_args}->{pid} ){
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             $obj->{server_args}->{pid} = $obj->pidfile . '.starman';
26             }
27             return $obj;
28             }
29              
30             sub reload {
31             my ( $self ) = @_;
32              
33             open FILE, $self->{server_args}->{pid} or die "Couldn't read pidfile";
34             chomp(my $pid = );
35              
36             kill HUP => $pid;
37             return 'reloaded';
38             }
39              
40              
41              
42             1;
43              
44             __END__