Browse Sections

CGI Programming (Part 4)


or displayed as:
This line is in bold
This is in italics

The parameters for the tag are passed as a hash (key-value) pair. If you want to display a text using an arial font with the size of 2, you can do this manually:

<FONT FACE=Arial, SIZE=2>Sample Text</FONT>
or
print $c->font({-face=>'Arial', -size=>'2'}, Sample Text);
To print the text in the same font but in italics and bold, you can do this:
print $c->i($c->b($c->font({-face=>'Arial', -size=>'2'}, Sample text) ) );

Generating Tables
To generate a table, you can do this: print $c->table({-border=>1},
$c->Tr({-valign=>'top'}, [
$c->td(['Row0 Col1', 'Col2', 'Col3'])
] ), # Matching close brackets for Tr
$c->Tr({-valign=>'top'}, [
$c->td(['Row1 Col1', 'Col2', 'Col3'])
] ), # Matching close brackets for Tr
); # Closing parenthesis for table

The result for this is:

Row 0 column 1 Column 2 Column 3
Row 2 column 1 Column 2 Column 3


For more information, you can check out the Perl documentation for CGI module

The copyright of the article CGI Programming (Part 4) in Perl is owned by Philip Yuson. Permission to republish CGI Programming (Part 4) in print or online must be granted by the author in writing.

Go To Page: 1 2

Articles in this Topic    Discussions in this Topic