Skip to content

Language specific Problems #6

@hisnameishb

Description

@hisnameishb

Example progressbar1/2/3.pl

$value = $progressbar->VALUE;

Returns a string: "0.002" on a System with locale where "." is the decimal mark.
When you use this value and set it back to any variable or use it in e.g. comparison operator like "<"
it is automatically converted to a number.

In some countries the decimal mark is not a point, it is a ",". The return string you get is: "0,002". When you use this in a numeric context e.g. comparison you get the 'Argument "0,002.." isn't numeric in ...' error.

Workaround:
After reading "numerical" values from a widget do after reading
$var =~ tr/,/./;

Better solution:
Change the API, return real numeric values, not strings.

Other countries using the ",":
https://en.wikipedia.org/wiki/Decimal_mark

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions