Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl错误只有在使用peronal模块Busybox时才是坏网关_Perl_Module_Openwrt_Busybox - Fatal编程技术网

Perl错误只有在使用peronal模块Busybox时才是坏网关

Perl错误只有在使用peronal模块Busybox时才是坏网关,perl,module,openwrt,busybox,Perl,Module,Openwrt,Busybox,我是perl新手,已经编写了一个带有per模块的脚本,它可以从命令行运行并显示所需的html,但是当我通过http运行它时,会出现一个错误的网关错误。我将整个脚本放在一个文件中,而不调用它将运行的自制模块。我正在Busybox上运行它。感谢您的帮助 #!/usr/bin/perl use strict; use warnings; use myperlfunc; #get Wifi info wifi_info (); # generate the page http_header();

我是perl新手,已经编写了一个带有per模块的脚本,它可以从命令行运行并显示所需的html,但是当我通过http运行它时,会出现一个错误的网关错误。我将整个脚本放在一个文件中,而不调用它将运行的自制模块。我正在Busybox上运行它。感谢您的帮助

#!/usr/bin/perl

use strict; 
use warnings;
use myperlfunc;

#get Wifi info
wifi_info ();

# generate the page
http_header();
html_header("Scan",1);
navibar("Scan");
Create_scan_buttons ( );
scan_button_actions ( );
print "</body>\n";
print "</html>\n";


######
myperlfunc;


sub http_header                         
{                                       
# print "Content-type: text/html\r\n";
print "Content-type: text/plain\n\n"; 
print "Cache-Control: no-store\r\n";  
#  print "\r\n";                       
}                                      

##start HTML Page##                    
sub html_header                        
{                                     
my($title, $close) = @_;           
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
print "<html>\n";                                                       
print "<head>\n";                                                           
print "<title>$title</title>\n";                                            
print "<meta http-equiv='expires' content='0'>\n";                          
print "<meta http-equiv='cache-control' content='no-cache'>\n";             
print "<meta http-equiv='pragma' content='no-cache'>\n";                    
print qq {<link href="../Site.css" rel="stylesheet">}; #used instead of escaping to print stylesheet
print "</head>\n";                                                                                  
print "<body>";                                                                                     
print "<H1><center>Welcome to bla bla  <br>bla bla bla...</H1>" if $close;                          

}                                                                                                  

1;
#/usr/bin/perl
严格使用;
使用警告;
使用myperlfunc;
#获取Wifi信息
wifi_info();
#生成页面
http_头();
html_标题(“扫描”,1);
navibar(“扫描”);
创建扫描按钮();
扫描按钮动作();
打印“\n”;
打印“\n”;
######
桃金娘;
子http_头
{                                       
#打印“内容类型:text/html\r\n”;
打印“内容类型:文本/纯文本\n\n”;
打印“缓存控制:无存储\r\n”;
#打印“\r\n”;
}                                      
##启动HTML页面##
子html_头
{                                     
我的($title,$close)=@;
打印“\n”;
打印“\n”;
打印“\n”;
打印“$title\n”;
打印“\n”;
打印“\n”;
打印“\n”;
打印qq{};#用于代替转义打印样式表
打印“\n”;
打印“”;
如果$close,打印“欢迎来到bla-bla
bla-bla-bla…”; } 1.
这是一个改进版,但仍有工作要做:

#!/usr/bin/perl
use strict;
use warnings;
use myperlfunc;

sub http_header {
   print "Content-type: text/plain\n\n";
   print "Cache-Control: no-store\r\n";
}

##start HTML Page##
sub html_header {
my ( $title, $close ) = @_;
print <<EOT;
 <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
 <html>
 <head>
 <title>$title</title>
 <meta http-equiv='expires' content='0'>
 <meta http-equiv='cache-control' content='no-cache'>
 <meta http-equiv='pragma' content='no-cache'>
 <link href="../Site.css" rel="stylesheet">
 #used instead of escaping to print stylesheet
</head>
<body>
EOT

print "<H1><center>Welcome to bla bla  <br>bla bla bla...</H1>" if $close;

}
#get Wifi info
wifi_info();
# generate the page

http_header();
html_header( "Scan", 1 );
navibar("Scan");
create_scan_buttons();
scan_button_actions();
print "</body>\n";
print "</html>\n";

# what is this mean to do?
myperlfunc;

exit 0;
#/usr/bin/perl
严格使用;
使用警告;
使用myperlfunc;
子http_头{
打印“内容类型:文本/纯文本\n\n”;
打印“缓存控制:无存储\r\n”;
}
##启动HTML页面##
子html_头{
我的($title,$close)=@;

打印说明:不同的标题行由一个返回分隔。标题本身由一个双返回分隔与其余内容。因此,标题函数应为:
print“content type:text/plain\n”;print“Cache Control:no store\n\n”
此外,对于多行html内容,通常最好使用
qq{}
,就像您对一行内容所做的那样,或者更好地使用HERE_DOC,这样您就可以将所有行组合成一条语句。