CSAILVision / CSAILVision/LabelMeAnnotationTool

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

未关闭
#110 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
1.5k
派生
443
PR 合并指标
30 天内没有已合并 PR

描述

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?

贡献指南

这个仓库没有索引到贡献指南

调研方向

打开 annotationTools/perl/fetch_image.cgi,检查第 24、49 和 74 行附近重复出现的 return 语句。使用 tool.html?mode=c&collection=empty 重现请求并检查 Apache 错误日志;解释或解决报告的 outside-a-subroutine 错误即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
perl
领域
backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。