Skip Menu |

This queue is for tickets about the Number-Format CPAN distribution.

Report information
The Basics
Id: 42522
Status: resolved
Priority: 0/
Queue: Number-Format

People
Owner: Nobody in particular
Requestors: d.raab [...] angel.de
Cc:
AdminCc:

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



Subject: format_price() incorrect.
Date: Mon, 19 Jan 2009 10:53:03 +0100
To: bug-Number-Format [...] rt.cpan.org
From: David Raab <d.raab [...] angel.de>
Hi, format_price() is Incorrect. Show quoted text
> my @prices = ( 1234, 56, 75.2345, 12578.5 ); > > my $nf = Number::Format->new( > THOUSANDS_SEP => q{.}, > DECIMAL_POINT => q{,}, > INT_CURR_SYMBOL => q{€}, > DECIMAL_DIGITS => 2, > DECIMAL_FILL => 1, > ); > > for my $price ( @prices ) { > print $nf->format_price($price, 2), "\n"; > }
This prints out: Show quoted text
> €1.234,00 > €56,00.00 > €75,23.00 > €12.578,50
The first and the last are correct but the second and the third are incorrect. It should be: Show quoted text
> €1.234,00 > €56,00 > €75,23 > €12.578,00
You need to set mon_thousands_sep and mon_decimal_point Please update to 1.63 which has some fixes related to locales.
Fixed in newer versions. You need to use the mon_ settings though.