blib/lib/Ubic/Service/Starman.pm

filter: Statementstmt 80.0% 20 / 25 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 2 / 2 totaltotal 76.9% 30 / 39 CC 4 SCAR 10.2
CC
4
Cov
74%
reload
6.0
new
3.0
BEGIN
1.0
CRAP 2.8
↑ Summary
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
BranchTrueFalseTotal
@_ > 1 ? : 1 1 2
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
BranchTrueFalseTotal
unless ($obj->{"server_args"}{"pid"}) 2 0 2
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
BranchTrueFalseTotal
open FILE, $self->{"server_args"}{"pid"} or die "Couldn't read pidfile" 0 0 0
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__
↑ Summary