Date: | Wed, 15 Dec 2004 09:29:02 -0800 (PST) |
From: | RMF <razvan_marcus [...] yahoo.com> |
Subject: | Convert-ASN1 0.18, bug EXPLICIT |
To: | bug-Convert-ASN1 [...] rt.cpan.org |
Hello,
I want to report a bug. Using the following ASN1
definition:
Message ::= CHOICE
{
a A,
b B
}
A ::= [2] EXPLICIT INTEGER
B ::= [3] EXPLICIT INTEGER
and for a value
my $enc =
{
a => 0
};
The function encode works corectly but decode
stops with the error:
Modification of a read-only value attempted at
Convert/ASN1/_decode.pm line 269.
If I transform the definition in
Message ::= CHOICE
{
a [2] EXPLICIT INTEGER,
b [3] EXPLICIT INTEGER
}
the decoding works, but the decoded hash contains a
suplementary unnamed level:
{
=> {
a => 0
}
}
Best regards
Razvan Marcus
PS
Here the perl script I used:
#!/usr/bin/perl
use Convert::ASN1;
use Data::Dumper;
$asn = Convert::ASN1->new;
$asn->prepare(q<
Message ::= CHOICE
{
a A,
b B
}
A ::= [2] EXPLICIT INTEGER
B ::= [3] EXPLICIT INTEGER
Show quoted text
>) || die $asn->error;
$mm = $asn->find("Message") || die $asn->error;
my $enc =
{
a => 0
};
$buffer = $mm->encode($enc) || die $mm->error;
print "Encoded: " . unpack("H*", $buffer) . "\n";
$out = $mm->decode($buffer) || die $mm->error;
print Dumper($out) . "\n";
Show quoted text__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250