Bug patch. The bug is that if you have any profile() calls with a
authorJay Hannah <jay@jays.net>
Tue, 18 Nov 2008 21:29:45 +0000 (21:29 +0000)
committerJay Hannah <jay@jays.net>
Tue, 18 Nov 2008 21:29:45 +0000 (21:29 +0000)
commit750d2587d042dd28eb0b3bbeda6707ba3bf4ae83
tree6e8a31a1e741d69d7d2d4de5eeb3e7fc45b55918
parentd9d04deddc21923005721f9f86298b068c656369
Bug patch. The bug is that if you have any profile() calls with a
begin =>   but no   end =>   and you call ->report() multiple
times, profile() will throw garbage items into the Tree::Simple.

By removing the map() from Stats.pm the bug no longer occurs.

I added a test item which fails until the Stats.pm patch is applied.

To see the bug in action, uncomment the   print scalar($stats->report);
line I added without the Stats.pm patch applied. You'll see ugly blank
lines show up in the report().

You can also see that   begin =>   with no   end =>   works fine without
the map() code. The map actually breaks it, it doesn't fix anything as
far as I can tell.

Possibly cleaner would be to patch profile() so that the garbage can
never happen, but I spent several hours on that and couldn't track it
down. This solves the problem and all tests pass. And removes code that
does nothing.

Cheers,

jhannah
jay(at)jays(dot)net
lib/Catalyst/Stats.pm
t/unit_stats.t