In function-oriented mode, the functions of CGI.pm are called directly. The Perl CGI module is loaded with use() function; the modifier :standard imports the standard set of funtions into your program.
header()
, start_html()
, h1()
, etc. are all functions of the CGI module that return HTML markup. Note that the arguments passed to the functions may be tags (header()
), attributes (-bgcolor=>'white'
), or content (h1('Starting CGI scripting')
).
#!/usr/local/bin/perl -w use CGI ':standard'; print header(), start_html(-title=>'hello', -bgcolor=>'white'), h1('Starting CGI scripting'), p('All the things you need for scripting'); print ol( li('patience'), li('endurance') ); print hr(); print h3('Forms'); print start_form(-method=>'post', -action=>'http://people.cs.uchicago.edu/~wfreis/cgi-bin/reflector.pl'), textfield(-name=>'textfield1', -size=>'50', -maxlength=>'50'), br, submit('submit', 'Submit'), endform(); print end_html();