簡體   English   中英

帶有Perl的CGI表

[英]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_tableend_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);

為什么刪除CGI-> print start_table作為字符串?

因為您不明智地沒有use strict打開。

如果有的話,將會出現以下錯誤:

Bareword "start_table" not allowed while "strict subs"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM