CSAILVision / CSAILVision/LabelMeAnnotationTool

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

Đang mở
#110 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
1.5k
Fork
443
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Mở annotationTools/perl/fetch_image.cgi và kiểm tra các câu lệnh return lặp lại quanh các dòng 24, 49 và 74. Tái hiện yêu cầu bằng tool.html?mode=c&collection=empty và kiểm tra nhật ký lỗi Apache; được xem là hoàn tất khi lỗi outside-a-subroutine được báo cáo đã được giải thích hoặc xử lý.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
perl
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.