ETLp/Plugin/Iterative/SteadyStateCheck.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 20 CC 1 SCAR 6.9
CC
1
Cov
0%
type
2.0
BEGIN
2.0
CRAP 2.0
1 package ETLp::Plugin::Iterative::PLSQL;
2  
3 use MooseX::Declare;
4  
5 =head1 NAME
6  
7 ETLp::Plugin::Iterative::SteadyStateCheck - Check that a file's size isn't
8 changing
9  
10 =cut
11  
12 class ETLp::Plugin::Iterative::SteadyStateCheck extends ETLp::Plugin {
13  
14 sub type {
15 return 'steady_state_check';
16 }
17  
18 method run (Str $filename) {
19 my $interval = $self->item->{interval} || 5;
20
21 my $curr_size = -s $filename;
22 sleep $interval;
23  
24 while ((-s $filename) != $curr_size) {
25 $curr_size = -s $filename;
26 sleep $interval;
27 }
28
29 return $filename;
30 }
31 }
32  
33 =head1 METHODS
34  
35 =head2 type
36  
37 Registers the plugin type.
38
39 =head2 run
40  
41 Wait until the size of the supplied file stops changing. Will pause for
42 the interval defined in the item before repeating the check. The
43 interval defaults to five seconds if none is provided.
44  
45 =head3 paramaters
46  
47 * filename - the name of the file under consideration
48
49 -head3 returns
50  
51 * filename - this will be the same as the supplied file name
52  
53  
54 =head1 LICENSE AND COPYRIGHT
55  
56 Copyright 2010 Redbone Systems Ltd
57  
58 This program is free software; you can redistribute it and/or modify it
59 under the terms of either: the GNU General Public License as published
60 by the Free Software Foundation; or the Artistic License.
61  
62 The terms are in the LICENSE file that accompanies this application