Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to make the table in perl cgi module?

114 views
Skip to first unread message

jackkon

unread,
Jun 5, 2001, 5:33:05 AM6/5/01
to
hi all:
I want to use the perl CGI.pm to create a table.
The table must have one head and two row.
The first column must span three columns in the first row.
How can I write the code in perl cgi.pm module.
Thanks a lot.

=========================================================================
use CGI;
use CGI::Pretty;
my $cgi=new CGI;
print $cgi->header;
print $cgi->start_html;
print $cgi->table(
{-border=>undef},
$cgi->caption({-align=>bottom,}, "subject"),
$cgi->Tr(
{-align=>center, -valign=>top},
[
$cgi->th([1,2,3,4,5]),
$cgi->td({-colspan=>3}, "one"), $cgi->td([four, five]), ## not correct
$cgi->td([A, B, C, D, E]),
],
)
);
print $cgi->end_html;
=========================================================================


--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

nob...@mail.com

unread,
Jun 5, 2001, 1:21:37 PM6/5/01
to
"jackkon" <jc...@mail2000.com.tw> writes:

: $cgi->Tr(


: {-align=>center, -valign=>top},
: [
: $cgi->th([1,2,3,4,5]),
: $cgi->td({-colspan=>3}, "one"), $cgi->td([four, five]), ## not correct
: $cgi->td([A, B, C, D, E]),
: ],
: )

The comma in the middle of the line marked "not correct" should be a dot.

--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\

Ron Savage

unread,
Jun 5, 2001, 7:16:08 PM6/5/01
to
See below

--
Cheers
Ron Savage
r...@savage.net.au
http://savage.net.au/index.html

jackkon <jc...@mail2000.com.tw> wrote in message news:9ficf5$o...@netnews.hinet.net...
: hi all:


: I want to use the perl CGI.pm to create a table.
: The table must have one head and two row.
: The first column must span three columns in the first row.
: How can I write the code in perl cgi.pm module.
: Thanks a lot.

:

Nice try, jackkon. Tested code follows.

-----><8-----
#!/perl/bin/perl

use integer;
use strict;
use warnings;

use CGI;

# ------------------------------------------------------------------

my($q) = CGI -> new();
my(@row) = $q -> td({colspan => 3}, 'Row 1 Col 1');
push(@row, $q -> td('Row 2 col 1') . $q -> td('Row 2 col 2') . $q -> td('Row 2 col 3') );
push(@row, $q -> td('Row 3 col 1') );

print $q -> header(),
$q -> start_html(),
$q -> table
(
{align => 'center', border => 1},
$q -> caption('Some caption'),
$q -> Tr([@row])
),
$q -> end_html();
-----><8-----

0 new messages