[英]CGI table with perl
我正在嘗試使用perl
使用CGI
構建登錄表單。
sub show_login_form{
return div ({-id =>'loginFormDiv'}),
start_form, "\n",
CGI->start_table, "\n",
CGI->end_table, "\n",
end_form, "\n",
div, "\n";
}
我想知道為什么我不需要在start_form
之前添加CGI->
,但是如果我在start_table
和end_table
之前不包括它, start_table
"start_table"
和"end_table"
打印為strings
嗎?
謝謝您的幫助。
因為您可能使用以下use語句導入它們:
use CGI qw(:standard);
如CGI中所記錄-使用面向功能的界面 ,這將導入“標准”功能,“ html2”,“ html3”,“ html4”,“ ssl”,“ form”和“ cgi”。
但這不包括表方法。
要獲得它們,您可以將use語句修改為以下內容:
use CGI qw(:standard *table);
因為您不明智地沒有use strict
打開。
如果有的話,將會出現以下錯誤:
Bareword "start_table" not allowed while "strict subs"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.