Update of /cvsroot/perl-ldap/asn/lib/Convert/ASN1
In directory usw-pr-cvs1:/tmp/cvs-serv8950/lib/Convert/ASN1
Modified Files:
_decode.pm _encode.pm
Log Message:
Add support for units with one sinlge, unamed entry
eg test ::= INTEGER or list ::= SEQUENCE OF OCTET STRING
Index: _decode.pm
===================================================================
RCS file: /cvsroot/perl-ldap/asn/lib/Convert/ASN1/_decode.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- _decode.pm 22 Jan 2002 11:24:28 -0000 1.12
+++ _decode.pm 10 Feb 2002 16:12:16 -0000 1.13
@@ -67,7 +67,7 @@
# We send 1 if there is not var as if there is the decode
# should be getting undef. So if it does not get undef
# it knows it has no variable
- ($seqof ? $seqof->[$idx++] : defined($var) ? $stash->{$var} : 1),
+ ($seqof ? $seqof->[$idx++] : defined($var) ? $stash->{$var} : ref($stash) eq 'SCALAR' ? $$stash : 1),
$buf,$npos,$len, $indef ? $larr : []
);
@@ -91,7 +91,7 @@
$buf,
);
- ($seqof ? $seqof->[$idx++] : defined($var) ? $stash->{$var} : undef)
+ ($seqof ? $seqof->[$idx++] : defined($var) ? $stash->{$var} : ref($stash) eq 'SCALAR' ? $$stash : undef)
= &{$ctr}(@ctrlist);
$pos = $npos+$len+$indef;
@@ -122,7 +122,7 @@
$len += $npos-$pos;
- ($seqof ? $seqof->[$idx++] : $stash->{$var})
+ ($seqof ? $seqof->[$idx++] : ref($stash) eq 'SCALAR' ? $$stash : $stash->{$var})
= substr($buf,$pos,$len);
$pos += $len + $indef;
@@ -145,7 +145,9 @@
my $nstash = $seqof
? ($seqof->[$idx++]={})
: defined($var)
- ? ($stash->{$var}={}) : $stash;
+ ? ($stash->{$var}={})
+ : ref($stash) eq 'SCALAR'
+ ? ($$stash={}) : $stash;
&{$decode[$cop->[cTYPE]]}(
$optn,
@@ -167,7 +169,9 @@
my $nstash = $seqof
? ($seqof->[$idx++]={})
: defined($var)
- ? ($stash->{$var}={}) : $stash;
+ ? ($stash->{$var}={})
+ : ref($stash) eq 'SCALAR'
+ ? ($$stash={}) : $stash;
_decode(
$optn,
Index: _encode.pm
===================================================================
RCS file: /cvsroot/perl-ldap/asn/lib/Convert/ASN1/_encode.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- _encode.pm 22 Jan 2002 11:24:28 -0000 1.13
+++ _encode.pm 10 Feb 2002 16:12:17 -0000 1.14
@@ -53,8 +53,9 @@
&{$encode[$op->[cTYPE]]}(
$optn,
$op,
- $stash,
- defined($var) ? $stash->{$var} : undef,
+ (ref($stash) ne 'HASH'
+ ? ({}, $stash)
+ : ($stash, defined($var) ? $stash->{$var} : undef)),
$_[4],
$op->[cLOOP],
$path,
|