for my $photo (@photos) {
print "Uploading $photo";
- my $response =
- $client->photos->upload(aid => $aid,
- data => scalar read_file($photo),
- caption => '',
- filename => basename($photo),
- );
+ my $response;
+ my $try=0;
+ while (not $response =
+ $client->photos->upload(aid => $aid,
+ data => scalar read_file($photo),
+ caption => '',
+ filename => basename($photo),
+ )) {
+ $try++;
+ print " [failure $try] ";
+ sleep 3;
+ last if $try > 10;
+ }
if (not $response) {
die "Upload failure at photo $photo";
}