List Info

Thread: Better $elapsed==0 handling.




Better $elapsed==0 handling.
country flaguser name
Italy
2007-07-18 13:14:33
Trivial, nonetheless improving.

Line 1339 in Catalyst.pm (from Catalyst-Runtime-5.7007)
reads:

my $av = sprintf '%.3f', ( $elapsed == 0 ? '??' : ( 1 /
$elapsed ) );

which of course triggers the warning:

Argument "??" isn't numeric in sprintf

when $elapsed==0 is true.
It also causes $av to be set to 0.000, which is a misleading
value, 
given the situation.

The obvious correction is to substitute the above mentioned
line with:

my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 /
$elapsed;

Patch (against Catalyst.pm in trunk -- Revision 6575)
attached, if 
necessary.

Cheers,
Emanuele.

_______________________________________________
Catalyst-dev mailing list
Catalyst-devlists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


  
Re: Better $elapsed==0 handling.
country flaguser name
United States
2007-07-19 06:48:55
Emanuele Zeppieri wrote:
> The obvious correction is to substitute the above
mentioned line with:
> 
> my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 /
$elapsed;
> 
> Patch (against Catalyst.pm in trunk -- Revision 6575)
attached, if 
> necessary.

Applied -- rev 6581. Thanks!

-Brian

_______________________________________________
Catalyst-dev mailing list
Catalyst-devlists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst-dev


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )