Flush buffers on thread closedown.
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index 0b7daa1..4b81fe5 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1493,7 +1493,7 @@ Perl_die_where(pTHX_ char *message, STRLEN msglen)
 #endif
        PerlIO *serr = Perl_error_log;
 
-       PerlIO_write(serr, message, msglen);
+       PERL_WRITE_MSG_TO_CONSOLE(serr, message, msglen);
        (void)PerlIO_flush(serr);
 #ifdef USE_SFIO
        errno = e;
@@ -3032,6 +3032,7 @@ PP(pp_require)
     GV *filter_child_proc = 0;
     SV *filter_state = 0;
     SV *filter_sub = 0;
+    SV *hook_sv = 0;
 
     sv = POPs;
     if (SvNIOKp(sv)) {
@@ -3060,6 +3061,9 @@ PP(pp_require)
                    "v%d.%d.%d, stopped", rev, ver, sver, PERL_REVISION,
                    PERL_VERSION, PERL_SUBVERSION);
            }
+           if (ckWARN(WARN_PORTABLE))
+               Perl_warner(aTHX_ WARN_PORTABLE,
+                        "v-string in use/require non-portable");
            RETPUSHYES;
        }
        else if (!SvPOKp(sv)) {                 /* require 5.005_03 */
@@ -3078,7 +3082,7 @@ PP(pp_require)
                if (sver == 0 && (rev > 5 || (rev == 5 && ver >= 100))) {
                    DIE(aTHX_ "Perl v%"UVuf".%"UVuf".%"UVuf" required--"
                        "this is only v%d.%d.%d, stopped"
-                       " (did you mean v%"UVuf".%"UVuf".0?)",
+                       " (did you mean v%"UVuf".%03"UVuf"?)",
                        rev, ver, sver, PERL_REVISION, PERL_VERSION,
                        PERL_SUBVERSION, rev, ver/100);
                }
@@ -3230,6 +3234,7 @@ trylocal: {
                    LEAVE;
 
                    if (tryrsfp) {
+                       hook_sv = dirsv;
                        break;
                    }
 
@@ -3319,7 +3324,9 @@ trylocal: {
 
     /* Assume success here to prevent recursive requirement. */
     (void)hv_store(GvHVn(PL_incgv), name, strlen(name),
-                  newSVpv(CopFILE(&PL_compiling), 0), 0 );
+                  (hook_sv ? SvREFCNT_inc(hook_sv)
+                           : newSVpv(CopFILE(&PL_compiling), 0)),
+                  0 );
 
     ENTER;
     SAVETMPS;