File Coverage

blib/lib/HiD/Server/Loader.pm
Criterion Covered Total %
statement 8 16 50.0
branch 0 4 0.0
condition n/a
subroutine 3 4 75.0
pod n/a
total 11 24 45.8


line stmt bran cond sub pod time code
1             # ABSTRACT: Another helper for 'hid publish -A'
2              
3              
4             package HiD::Server::Loader;
5             our $AUTHORITY = 'cpan:GENEHACK';
6             $HiD::Server::Loader::VERSION = '1.991';
7 4     4   84 use 5.014; # strict, unicode_strings
  4         16  
8 4     4   23 use warnings;
  4         11  
  4         114  
9              
10 4     4   17 use parent 'Plack::Loader::Restarter';
  4         9  
  4         20  
11              
12             # FIXME this is kinda not the greatest idea but this is less re-implementation
13             # than overriding the 'run' method and there really are zero hooks provided
14             # for this...
15             sub _fork_and_start {
16 0     0     my($self, $server) = @_;
17              
18 0           delete $self->{pid}; # re-init in case it's a restart
19              
20 0           my $pid = fork;
21 0 0         die "Can't fork: $!" unless defined $pid;
22              
23 0 0         if ($pid == 0) { # child
24 0           $server->republish();
25              
26 0           return $server->run($self->{builder}->());
27             }
28             else {
29 0           $self->{pid} = $pid;
30             }
31             }
32              
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             HiD::Server::Loader - Another helper for 'hid publish -A'
44              
45             =head1
46              
47             Another helper for C<hid publish -A>
48              
49             =head1 VERSION
50              
51             version 1.991
52              
53             =head1 AUTHOR
54              
55             John SJ Anderson <genehack@genehack.org>
56              
57             =head1 COPYRIGHT AND LICENSE
58              
59             This software is copyright (c) 2015 by John SJ Anderson.
60              
61             This is free software; you can redistribute it and/or modify it under
62             the same terms as the Perl 5 programming language system itself.
63              
64             =cut