line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::sleep; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
106189
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
18
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
25
|
use Moo; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
12
|
|
8
|
2
|
|
|
2
|
|
820
|
use Time::HiRes; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
28
|
|
9
|
2
|
|
|
2
|
|
177
|
use namespace::clean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
10
|
2
|
|
|
2
|
|
1106
|
use Catmandu::Fix::Has; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Inlineable'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has seconds => (fix_arg => 1); |
15
|
|
|
|
|
|
|
has units => (fix_arg => 1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub fix { |
18
|
4
|
|
|
4
|
0
|
34
|
my ($self, $data) = @_; |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
16
|
my $sleep = $self->seconds; |
21
|
4
|
|
|
|
|
13
|
my $units = $self->units; |
22
|
|
|
|
|
|
|
|
23
|
4
|
50
|
|
|
|
46
|
if ($units =~ /^microsecond(s)?$/i) { } |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
24
|
|
|
|
|
|
|
elsif ($units =~ /^millisecond(s)$/i) { |
25
|
0
|
|
|
|
|
0
|
$sleep *= 1000; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ($units =~ /^second(s)?$/i) { |
28
|
3
|
|
|
|
|
11
|
$sleep *= 1000000; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ($units =~ /^minute(s)?$/i) { |
31
|
0
|
|
|
|
|
0
|
$sleep *= 60 * 1000000; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
elsif ($units =~ /^hour(s)?$/i) { |
34
|
0
|
|
|
|
|
0
|
$sleep *= 3600 * 1000000; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { |
37
|
1
|
|
|
|
|
3
|
$sleep *= 1000000; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
2500806
|
Time::HiRes::usleep($sleep); |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
353
|
$data; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=pod |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Catmandu::Fix::sleep - Do nothing for a specified amount of time |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SYNOPSIS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sleep(10,MICROSECONDS) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sleep(3,MILLISECONDS) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sleep(1,SECOND) |
62
|
|
|
|
|
|
|
sleep(2,SECONDS) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sleep(5,MINUTES) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sleep(1,HOURS) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<Catmandu::Fix> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |