in reply to Convert::ASN1

Are you talking about using the find function? As I understand it you must use find to do nested defs. Could you show some code where you are able to do the encoding side so I can see if I am talking about the same thing here?

-Waswas

Replies are listed 'Best First'.
Re: Re: Convert::ASN1
by Anonymous Monk on Jul 22, 2003 at 14:15 UTC
    Hi Waswas,

    Here's a bit from my init routine (the ::desc package variables contain the ASN.1 descriptions; the _asn variables are class data (so I don't have to re-prepare the ASN.1 descriptions over and over) - I can send the whole module if you'd like):

    my $asn_ext = Convert::ASN1->new; $asn_ext->prepare( $Biblio::ILL::ISO::1_0_10161_13_3::desc ); # some error checking here, snipped for brevity $_asn = Convert::ASN1->new; $_asn->prepare( $Biblio::ILL::ISO::asn::desc ); # some error checking here, snipped for brevity $_asn_initialized = 1; # "1.0.10161.13.3" is what it *should* be, according to the ISO 10 +161 maintenance agency: #$_asn->registeroid("1.0.10161.13.3",$asn_ext->find("APDU-Delivery +-Info")); # "1" is what it *is*, by looking at a hex dump of the request rec +ord $_asn->registeroid("1",$asn_ext->find("APDU-Delivery-Info"));

    The encode routine:

    sub encode { my $self = shift; my $href = $self->as_asn(); # builds a Convert::ASN1-parsable hash my $asn = $_asn->find( 'ILL-Request' ) or warn $_asn->error; my $pdu = $asn->encode( $href ) or warn $asn->error; return $pdu; }

    And the decode routine:

    sub decode { my $self = shift; my $pdu = shift; my $asn = $_asn->find( 'ILL-Request' ) or warn $_asn->error; my $href = $asn->decode( $pdu ) or warn $asn->error; return $href; }

    I *think* the question is: How do I, in the middle of an 'ILL-Request' decode, tell it to find('APDU-Delivery-Info') when/if it encounters that extension code?

    Of course, I could be completely misunderstanding the way that Convert::ASN1 works. :-)

      Oops, that was me (bibliophile) - I forgot to log in, sigh.