CSAILVision / CSAILVision/LabelMeAnnotationTool

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

Offen
#110 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
1.5k
Forks
443
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.