Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 76949
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: vol7ron.forum [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



It is taking forever to creating a HTML table (sometimes there is a not-enough memory error). The steps are simple from a DBI handle. Create a TD for each field and a TR for each record. my @fieldNames = qw(foo bar foobar foofoo barbar foofoobar); my $row,$tbody,$tfoot; # Create THEAD/TFOOT ... # # Create TBODY foreach my $primary_key ($recordset_hashref) { $row = ''; foreach my $field (@fieldNames){ $row .= td({-class=>"foo-class bar-class foobar-class"}, $recordset_hashref->{$field}); } $tbody .= Tr($row); } print table({-id=>"cgi-created-table"},thead($thead),tfoot($tfoot),tbody($tbody)); When the table is large for an HTML page (eg ~1k records), this hangs a few seconds. Someone on Perlmonks noted that it might be recursively copying the created string, which seems inefficient.
Subject: Re: [rt.cpan.org #76949]
Date: Thu, 03 May 2012 08:23:44 -0400
To: bug-CGI [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> It is taking forever to creating a HTML table (sometimes there is a > not-enough memory error). > > The steps are simple from a DBI handle. Create a TD for each field and > a TR for each record. > > my @fieldNames = qw(foo bar foobar foofoo barbar foofoobar); > my $row,$tbody,$tfoot; > > # Create THEAD/TFOOT > ... > # > > # Create TBODY > foreach my $primary_key ($recordset_hashref) > { > $row = ''; > foreach my $field (@fieldNames){ > $row .= td({-class=>"foo-class bar-class foobar-class"}, > $recordset_hashref->{$field}); > } > $tbody .= Tr($row); > } > > print > table({-id=>"cgi-created-table"},thead($thead),tfoot($tfoot),tbody($tbody));
There are no plans to make significant updates to the HTML generation code in CGI.pm. Unless you want to patch it, I suggest you use a templating engine instead. Mark