-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.pl
More file actions
78 lines (63 loc) · 1.51 KB
/
Copy pathbase.pl
File metadata and controls
78 lines (63 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Getopt::Long;
use POSIX qw(ceil);
use FindBin qw($Bin);
use lib qq{$Bin/../lib};
use parent 'Batcher';
sub new {
my $self = shift;
my $vals = shift // {_opts => {}};
my $blsd = bless $vals, $self;
$blsd->_get_opts;
$blsd;
}
sub opts {shift->{'_opts'}}
sub _get_opts {
my $self = shift;
my %get_opts = ();
for my $k (keys %{$self->option_params}) {
my ($long, $short, $type) = $k =~ /^([^|]+)(?:[|]([^=]+))?([=]\w)?$/g;
my $default_val = $self->option_params->{$k};
if (!defined $self->opts->{$long}) {
$self->{'_opts'}->{$long} = $default_val;
}
$get_opts{$k} = \$self->{'_opts'}->{$long};
}
GetOptions(%get_opts);
}
sub option_params {
return {
'debug|D' => 0,
'forks|f=i' => 10,
'limit|l=i' => 0,
'batchsize|s=i' => 2,
};
}
sub debug {shift->opts->{'debug'}}
sub forks {shift->opts->{'forks'}}
sub limit {shift->opts->{'limit'}}
# required by Batcher
sub batch_count {
my $self = shift;
# TODO: return number of batchs in total result set
}
# required by Batcher
sub batch_next {
my ($self, $next_idx) = @_;
# TODO: return the next batch of results
}
# required by Batcher
sub batch_size {
my $self = shift;
# TODO: return the number of results in a batch
}
# required by Batcher
sub batch_result {
my ($self, $result) = @_;
# TODO: something with the result ...
}
__PACKAGE__->new->run;
exit;