no need for Array::Iterator even though it was cute

This commit is contained in:
Oliver Gorwits
2017-11-16 20:50:16 +00:00
parent 71ee869c02
commit 68a56d35bb
2 changed files with 3 additions and 4 deletions

View File

@@ -4,7 +4,6 @@ use strict;
use warnings; use warnings;
use Module::Load (); use Module::Load ();
use Array::Iterator;
use Dancer qw/:moose :syntax/; use Dancer qw/:moose :syntax/;
use Moo::Role; use Moo::Role;
@@ -49,7 +48,7 @@ sub load_workers {
} }
} }
$self->$pname( Array::Iterator->new({ __array__ => \@wset }) ); $self->$pname( \@wset );
} }
} }

View File

@@ -68,12 +68,12 @@ sub run_workers {
my $set = shift my $set = shift
or return $job->add_status( Status->error('missing set param') ); or return $job->add_status( Status->error('missing set param') );
return unless ref $self->$set and $self->$set->get_length(); return unless ref [] eq ref $self->$set and 0 < scalar @{ $self->$set };
(my $phase = $set) =~ s/^workers_//; (my $phase = $set) =~ s/^workers_//;
$job->enter_phase($phase); $job->enter_phase($phase);
while (my $worker = $self->$set->get_next()) { foreach my $worker (@{ $self->$set }) {
try { $job->add_status( $worker->($job) ) } try { $job->add_status( $worker->($job) ) }
catch { catch {
debug "=> $_" if $_; debug "=> $_" if $_;