line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Proc::tored::Flag; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$Proc::tored::Flag::VERSION = '0.20'; |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
241874
|
use strict; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
113
|
|
6
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
114
|
|
7
|
3
|
|
|
3
|
|
461
|
use Moo; |
|
3
|
|
|
|
|
9831
|
|
|
3
|
|
|
|
|
25
|
|
8
|
3
|
|
|
3
|
|
2325
|
use Path::Tiny 'path'; |
|
3
|
|
|
|
|
8227
|
|
|
3
|
|
|
|
|
229
|
|
9
|
3
|
|
|
3
|
|
426
|
use Types::Standard -types; |
|
3
|
|
|
|
|
54411
|
|
|
3
|
|
|
|
|
28
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has touch_file_path => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => Str, |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has file => ( |
18
|
|
|
|
|
|
|
is => 'lazy', |
19
|
|
|
|
|
|
|
isa => InstanceOf['Path::Tiny'], |
20
|
|
|
|
|
|
|
handles => { |
21
|
|
|
|
|
|
|
set => 'touch', |
22
|
|
|
|
|
|
|
unset => 'remove', |
23
|
|
|
|
|
|
|
is_set => 'exists', |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
11
|
|
|
11
|
|
34006
|
sub _build_file { path($_[0]->touch_file_path) } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=pod |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding UTF-8 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Proc::tored::Flag - Ties a runtime flag to the existence of a touch file |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 VERSION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
version 0.20 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Proc::tored::Flag; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $fnord = Proc::tored::Flag->new(touch_file_path => '/my/service/path'); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$fnord->set; # touch file created if not already there |
52
|
|
|
|
|
|
|
$fnord->is_set; # true |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$fnord->unset; # touch file removed if it exists |
55
|
|
|
|
|
|
|
$fnord->is_set; # false |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
if ($fnord->is_set) { |
58
|
|
|
|
|
|
|
warn "forgot what to do"; |
59
|
|
|
|
|
|
|
exit 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Jeff Ober <sysread@fastmail.fm> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Jeff Ober. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
71
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|