Reputation: 1427
My exception handling catches the exception but redo throws some error.
I am using 3rd party api to get more than 5 million datas but that api frequently throws 500 error.
I am using exception handling and if any error occurs i want to redo the loop
eval{
while(my $productsRef = $se->iterate_products()) {
print Dumper($productsRef);
}
};
if ($@){
sleep 30;
redo;
}
The above code throws error if some exception is caught
cant "redo" outside the loop
Upvotes: 1
Views: 97
Reputation: 50637
You can't redo
outside of loop or a basic-block,
REDO_EVAL: {
my $ok = eval {
while(my $productsRef = $se->iterate_products()) {
print Dumper($productsRef);
}
1;
};
if (!$ok){
# print "$@\n";
sleep 30;
redo;
}
}
Upvotes: 2