CSAILVision / CSAILVision/LabelMeAnnotationTool

fetch_image.cgi: Can't return outside a subroutine ...

Ouverte
#110 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
1.5k
Forks
443
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I am looking at the code in `https://github.com/CSAILVision/LabelMeAnnotationTool/blob/master/annotationTools/perl/fetch_image.cgi` and keep seeing `return` statement being used outside of a function, like this

```
if(!open(FP,$fname)) {
print "Status: 404\n\n";
return; # <--- this one o_O
}
```

it repeats over an over again, e.g. at lines 24, 49, 74, etc

Perl would throw an error in such cases `Can't return outside a subroutine ...`. Which is expected, because `return` is used to return from a subroutine and there are no subroutines defined in the whole script. Indeed, you will see the error message appear in apache error log if you try with a faked URL (note `collection=empty` that corresponds to no file)

```
tool.html?mode=c&collection=empty
```

What am I missing? Is it just a joke?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Ouvrez annotationTools/perl/fetch_image.cgi et examinez les instructions return répétées autour des lignes 24, 49 et 74. Reproduisez la requête avec tool.html?mode=c&collection=empty et consultez le journal des erreurs Apache ; le travail est considéré comme terminé lorsque l’erreur outside-a-subroutine signalée est expliquée ou résolue.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
perl
Domaine
backend
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.