NAME

oEdtk::SignedField - signed amount field (Infinite encoding)

SYNOPSIS

use oEdtk::SignedField;

my $field = oEdtk::SignedField->new('MONTANT', 8, 2);
print $field->process('00001234'), "\n";   # '12.34'

DESCRIPTION

An oEdtk::Field subclass decoding a signed amount that follows the Infinite convention: the trailing byte, when it is a letter in the range p..y, both carries the last digit and marks the amount negative. A value whose shape does not match the expected form raises a warning.

METHODS

new

my $field = oEdtk::SignedField->new($name, $ilen, $flen);

Construct a field whose byte length is $ilen + $flen. $flen defaults to 0.

process

my $value = $field->process($data);

Strip the blanks from $data; warn when it is not a plain (optionally signed) number with an optional trailing p..y letter. An empty value becomes 0; a trailing p..y letter replaces the last digit with its value and negates the amount. When $flen is set the value is scaled and formatted with $flen decimals.

AUTHOR

The oEdtk team.