TaskPipe/Tool/Command__OpenProxies.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 CC 3 SCAR 18.4
CC
3
Cov
0%
execute
12.0
execute_specific
2.0
BEGIN
2.0
CRAP 6.3
1 package TaskPipe::Tool::Command__OpenProxies;
2  
3 use Moose;
4 use MooseX::ClassAttribute;
5 extends 'TaskPipe::Tool::Command';
6 with 'MooseX::ConfigCascade';
7  
8 use TaskPipe::OpenProxyManager;
9  
10 has schema_manager => (is => 'rw', isa => 'TaskPipe::SchemaManager', lazy => 1, default => sub{
11 my $sm = TaskPipe::SchemaManager->new;
12 $sm->connect_schema;
13 return $sm;
14 });
15  
16  
17 class_has option_specs => (is => 'ro', isa => 'ArrayRef', default => sub{[{
18 module => 'TaskPipe::OpenProxyManager::Settings',
19 is_config => 1
20 }]});
21  
22  
23 has proxy_manager => (is => 'ro', isa => 'TaskPipe::OpenProxyManager', lazy => 1, default => sub{
24 TaskPipe::OpenProxyManager->new(
25 gm => $_[0]->schema_manager
26 );
27 });
28  
29 has job_manager => (is => 'ro', isa => 'TaskPipe::JobManager', lazy => 1, default => sub{
30 TaskPipe::JobManager->new(
31 name => $_[0]->name,
32 project => '*global'
33 );
34 });
35  
36  
37 sub execute{
38 my $self = shift;
39  
40 $self->run_info->scope( 'global' );
41  
42 if ( $self->proxy_manager->settings->shell eq 'background' ){
43 $self->run_info->shell('background');
44 $self->job_manager->daemonize;
45 }
46
47 my $repeat = $self->proxy_manager->settings->iterate eq 'repeat'?1:0;
48  
49 do {
50 $self->execute_specific;
51 } while ( $repeat );
52 }
53  
54 sub execute_specific{
55  
56 confess "Override in child";
57  
58 }
59  
60 =head1 NAME
61  
62 TaskPipe::Tool::Command__OpenProxies - base calss for open proxy related commands
63  
64 =head1 DESCRIPTION
65  
66 This is the base class for commands related to open proxies (fetch open proxies and test open proxies both inherit from this class).
67  
68 Note the double underscore __ in the name tells L<TaskPipe::Tool> this is a base class and to ignore it from the commands list.
69  
70 It is not recommended to use this class directly.
71  
72 =head1 AUTHOR
73  
74 Tom Gracey <tomgracey@gmail.com>
75  
76 =head1 COPYRIGHT AND LICENSE
77  
78 Copyright (c) Tom Gracey 2018
79  
80 TaskPipe is free software, licensed under
81  
82 The GNU Public License Version 3
83  
84 =cut
85  
86  
87  
88 __PACKAGE__->meta->make_immutable;
89  
90 1;