diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-10-11 20:28:32 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-10-11 20:28:32 +0000 |
commit | 2b6c5635bc48c0253928a53128e6cda1b8ab68c0 (patch) | |
tree | ec39c560e556f3529c5e0028f7a33745cc2f48e0 /pp.c | |
parent | 082ab4105db91207118a22ff2c45d50a1b772838 (diff) | |
download | perl-2b6c5635bc48c0253928a53128e6cda1b8ab68c0.tar.gz |
more pack/unpack documentation (from Ilya Zakharevich); changed
the behavior of 'Z*' and 'Z3' to always pack a trailing
null byte; changed documentation to suit; added test
p4raw-id: //depot/perl@4346
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -4427,10 +4427,16 @@ PP(pp_pack) case 'a': fromstr = NEXTFROM; aptr = SvPV(fromstr, fromlen); - if (pat[-1] == '*') + if (pat[-1] == '*') { len = fromlen; - if (fromlen > len) + if (datumtype == 'Z') + ++len; + } + if (fromlen >= len) { sv_catpvn(cat, aptr, len); + if (datumtype == 'Z') + *(SvEND(cat)-1) = '\0'; + } else { sv_catpvn(cat, aptr, fromlen); len -= fromlen; |