Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Convert-ASN1 CPAN distribution.

Report information
The Basics
Id: 15280
Status: resolved
Priority: 0/
Queue: Convert-ASN1

People
Owner: Nobody in particular
Requestors: kathryn [...] hellbunnie.org
Cc:
AdminCc:

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



Subject: Not a bug, just a query
From: Kathryn Cassidy <kathryn [...] hellbunnie.org>
To: bugs-Convert-ASN1 [...] rt.cpan.org
Date: Tue, 25 Oct 2005 10:35:43 +0100
Hi there, I'm using Convert::ASN1 and I'm having some trouble encoding data into a CHOICE statement. The ASN statement prepares with no errors, but when I try to put data into it I'm getting an invalid structure and can't read data from it again. I've googled for a while but can't find many examples of using your module. Would it be possible for you to send me a simple example of how to encode data in a CHOICE or point me at an url that contains examples? Thanks a million, Kathryn.
Date: Tue, 25 Oct 2005 16:38:14 -0500 (CDT)
Subject: Re: [cpan #15280] Not a bug, just a query
From: "Graham Barr" <gbarr [...] pobox.com>
To: bug-Convert-ASN1 [...] rt.cpan.org
RT-Send-Cc:
On Tue, October 25, 2005 4:37 am, kathryn@hellbunnie.org via RT wrote: Show quoted text
> I'm using Convert::ASN1 and I'm having some trouble encoding data into a > CHOICE statement. The ASN statement prepares with no errors, but when I > try to put data into it I'm getting an invalid structure and can't read > data from it again. I've googled for a while but can't find many > examples of using your module. Would it be possible for you to send me > a simple example of how to encode data in a CHOICE or point me at an url > that contains examples?
It is probably easier if you could send me a small example of what you are trying to do and I can try to fix it. Graham.
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #15280] Not a bug, just a query
Date: Thu, 27 Oct 2005 19:21:28 -0500
To: bug-Convert-ASN1 [...] rt.cpan.org
RT-Send-Cc:
I added warn $@ after the encode to see why it failed, it reported No value found for CHOICE posreports.0 at asntest.pl line 22 This led me to look at the ASN and values you pass. posreports is PosReports ::= SEQUENCE OF PosReportItems PosReportItems ::= CHOICE { unitreport PosEventUnit, batchreport PosEventBatch, errorreport PosEventError } And you passed posreports => [ { reporttype => 0, prodid => '111', amount => '1000', downloadtime => '20050811095306', saletime => '20050812130828', serial => '1348234295', status => 0, custinfo => '25' } You are not telling it which part of the choice to encode. If you change your code to posreports => [ { unitreport => { reporttype => 0, prodid => '111', amount => '1000', downloadtime => '20050811095306', saletime => '20050812130828', serial => '1348234295', status => 0, custinfo => '25' } } then it encodes and decodes fine. Graham.
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #15280] Not a bug, just a query
Date: Wed, 9 Nov 2005 19:27:45 -0600
To: bug-Convert-ASN1 [...] rt.cpan.org
RT-Send-Cc:
Argh, this should be caught by ->prepare. Your choice looks like PosReportItems ::= CHOICE { batchreport PosEventBatch, unitreport PosEventUnit } The problem is that both PosEventBatch and PosEventUnit are sequences and so have an identical BER tag. In a choice each element must have a unique tag as that is the only thing used when decoding to determine which is there. So by changing it to something like PosReportItems ::= CHOICE { batchreport [0] PosEventBatch, unitreport [1] PosEventUnit } You script works. Graham. PS: For future questions (not bugs) please contact my email gbarr@pobox.com