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 | 98485b38a7f16148bd71cb9ff1c3ade8d491ef5f (patch) | |
tree | ec39c560e556f3529c5e0028f7a33745cc2f48e0 /pp.c | |
parent | c453f11f2af4f3e1ab8cffd4152a877d026dd4a6 (diff) | |
download | perl-98485b38a7f16148bd71cb9ff1c3ade8d491ef5f.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; |