Subject: | Convert-ASN1-0.19 new BCDString feature problem. |
Hallo dear Graham,
your module is awsome. Unfortunatelly I'm getting some problems with your last release Convert-ASN1-0.19.
in the function "_enc_bcd", $str is -1 when the parameter of sprintf ($_[3]) is a big number, eg 9999999999.
--function----------------------------------------------------
sub _enc_bcd {
my $str = sprintf("%d",$_[3]);
$str .= "F" if length($str) & 1;
$_[4] .= asn_encode_length(length($str) / 2);
$_[4] .= pack("H*", $str);
}
--------------------------------------------------------------
--example-----------------------------------------------------
#!/usr/bin/perl -w
use Convert::ASN1;
$asn = Convert::ASN1->new;
$asn->prepare(q<
[APPLICATION 7] SEQUENCE {
int INTEGER,
str OCTET STRING,
jav BCDString
}
Show quoted text
>);
$pdu = $asn->encode( int => 7, str => "string", jav =>"900019999911111" );
$out = $asn->decode($pdu);
print $out->{int}," ",$out->{str}," ", $out->{jav},"\n";
-------------------------------------------------------------
I'm using linux over pentium (perl v5.8.3).
cheers.
Javier.