Integrate with perlio.
[p5sagit/p5-mst-13.2.git] / pp_pack.c
index 021c35c..594144e 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -922,6 +922,8 @@ PP(pp_unpack)
            }
            break;
        case 'P':
+           if (star)
+               DIE(aTHX_ "P must have an explicit size");
            EXTEND(SP, 1);
            if (sizeof(char*) > strend - s)
                break;
@@ -1386,7 +1388,7 @@ PP(pp_pack)
        case 'a':
            fromstr = NEXTFROM;
            aptr = SvPV(fromstr, fromlen);
-           if (pat[-1] == '*') {
+           if (pat[lengthcode ? -2 : -1] == '*') { /* -2 after '/' */  
                len = fromlen;
                if (datumtype == 'Z')
                    ++len;
@@ -1841,7 +1843,7 @@ PP(pp_pack)
            fromstr = NEXTFROM;
            aptr = SvPV(fromstr, fromlen);
            SvGROW(cat, fromlen * 4 / 3);
-           if (len <= 1)
+           if (len <= 2)
                len = 45;
            else
                len = len / 3 * 3;