Skip to content

Commit 7651959

Browse files
committed
indexer: restructure the try/catch for dist indexing
This should be functionally the same, but a bit easier to read and reason about.
1 parent f989295 commit 7651959

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

lib/PAUSE/mldistwatch.pm

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -461,31 +461,29 @@ sub maybe_index_dist {
461461
}
462462
}
463463

464-
for my $method (qw(
465-
examine_dist
466-
read_dist
467-
extract_readme_and_meta
468-
check_indexability
469-
check_blib
470-
check_multiple_root
471-
check_world_writable
472-
)) {
473-
my $ok = eval { $dio->$method($ctx); 1; };
474-
my $abort = $@;
475-
if (!$ok) {
476-
if (! $abort->isa('PAUSE::Indexer::Abort')) {
477-
die $abort; # Rethrow unexpected exception
478-
}
464+
my $examine_dist_ok = eval {
465+
$dio->examine_dist($ctx);
466+
$dio->read_dist($ctx);
467+
$dio->extract_readme_and_meta($ctx);
468+
$dio->check_indexability($ctx);
469+
$dio->check_blib($ctx);
470+
$dio->check_multiple_root($ctx);
471+
$dio->check_world_writable($ctx);
472+
1;
473+
};
479474

480-
delete $self->{ALLlasttime}{$dist};
481-
delete $self->{ALLfound}{$dist};
475+
unless ($examine_dist_ok) {
476+
my $abort = $@;
477+
die $abort unless $abort->isa('PAUSE::Indexer::Abort');
482478

483-
if ($abort->public) {
484-
$dio->mail_summary($ctx);
485-
}
479+
delete $self->{ALLlasttime}{$dist};
480+
delete $self->{ALLfound}{$dist};
486481

487-
return;
482+
if ($abort->public) {
483+
$dio->mail_summary($ctx);
488484
}
485+
486+
return;
489487
}
490488

491489
for my $attempt (1 .. 3) {

0 commit comments

Comments
 (0)