A Lot of Columns to Span

Working still on the new “page display engine” way of doing things and I suddenly started getting really weird shit happening, I’d load up the page that was, as far as I remember (well, we know how good that is) was working last night and suddenly in mozilla or galeon it sits there spinning for about 30s, taking up 100% CPU and really pissing me off. I fiddled with a bunch of stuff but no advancement. Konqueror seemed fine, opera was doing strange things (not displaying text at all), so it was a write off.


Started putting die()‘s in my program (again, working last night), starting literally at the top. I finally narrowed it down to one line:



<td align=”center” colspan=”$cols”>



Pretty innocuous right? $cols is just a calculated value of the number of columns that this table cell has to span. Well, I thought that anyway, as it was working in a different function properly. When I display the values of $cols it is 139050069 Guess my code to calcuate it is off a bit 🙂


my $cols = scalar( $data->{$page}->{fields}) + 1; #wrong


The correct code is:


my $cols = $#{$data->{$page}->{fields}} + 1; #right


Interesting that mozilla takes 100% CPU to render a 139 million colspan, but konqueror and IE render it in 0 time. Bugzilla time!