I am trying to build a login form with CGI
, using perl
.
sub show_login_form{
return div ({-id =>'loginFormDiv'}),
start_form, "\n",
CGI->start_table, "\n",
CGI->end_table, "\n",
end_form, "\n",
div, "\n";
}
I was wondering why I don't need to add CGI->
before start_form
but if I don't include it before start_table
and end_table
, "start_table"
and "end_table"
are printed as strings
?
Thank you for your help.
Because you are likely importing them using the following use statement:
use CGI qw(:standard);
As documented in CGI - Using the function oriented interface, this will import "standard" features, 'html2', 'html3', 'html4', 'ssl', 'form' and 'cgi'.
But that does not include the table methods.
To get them too, you can modify your use statement to the following:
use CGI qw(:standard *table);
Because you unwisely do not have use strict
turned on.
If you had, you would've gotten the following error:
Bareword "start_table" not allowed while "strict subs"