add a lab directory
[gitmo/MooseX-Daemonize.git] / lab / dec.pl
CommitLineData
cbff8e52 1#!/usr/bin/env perl -l
2
3package TestDaemon;
4use Moose;
5with('MooseX::Daemonize');
6
7before 'daemonize' => sub {
8 warn 'forking ' . $$;
9};
10
11after 'start' => sub {
12 return unless $_[0]->is_daemon;
13 while (1) {
14 local *LOG;
15 open LOG, '>>', '/tmp/testdaemon.log';
16 print LOG "$0:$$";
17 close LOG;
18 sleep 1;
19 }
20};
21
22package main;
23my $td = new_with_options TestDaemon( pidbase => '/tmp' );
24use YAML;
25warn Dump $td->pidfile;
26warn $td->check;
27print "PARENT: $$";
28print 'PID: ' . $td->get_pid;
29print $td->start;