2015-01-29 1 views
1

아래 코드는 나에게 헤더 전에 스크립트 출력의펄 CGI ::의 validate()

끝 제공 : secondcgi

을하지만 Opts::validate(); 라인을 주석 때 잘 작동 . 도와 주시겠습니까? 내가이

print "Content-Type: text/html\n\n"; 
print "<html>"; 
print "<head>"; 
print "<title>Hello - Second CGI Program</title>"; 
print "</head>"; 
print "<body>"; 
print "start <br>"; 
Opts::validate(); 
print "<h2>can't see this part</h2>"; 
print "$result"; 
print "</body>"; 
print "</html>"; 

같은 후 이동하면

#!/usr/bin/perl 
use CGI; 
use VMware::VIRuntime; 
my %opts; 

Opts::add_options(%opts); 
Opts::parse(); 
Opts::validate(); 


print "Content-Type: text/html\n\n"; 
print "<html>"; 
print "<head>"; 
print "<title>Hello - Second CGI Program</title>"; 
print "</head>"; 
print "<body>"; 
print "start"; 

Util::connect(); 
print "second start after connect"; 
&check_server; 
print "<h2>Hello alsu</h2>"; 
print "$message"; 
print "</body>"; 
print "</html>"; 

내가이 선 아래 아무것도 볼 수 없습니다

답변

1

그 오류는 특히 스크립트에서 뭔가 스크립트 이전에 인쇄 된 것을 의미한다 헤더 :

print "Content-Type: text/html\n\n"; 

Content-Type 웹 서버가 오류를 생성하므로 일 가능성이 높습니다.Opts::validate();에서 일종의 출력 또는 경고를 생성하고 있음을 의미합니다.

내용 유형 행 다음으로 이동하고 실제로이 무엇인지 확인하십시오. (웹 페이지의 소스보기).

관련 문제