This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Croak on unimplemented already at import time
[perl5.git] / op.c
diff --git a/op.c b/op.c
index fcb1bc6..93205fe 100644 (file)
--- a/op.c
+++ b/op.c
@@ -109,7 +109,7 @@ recursive, but it's recursive on basic blocks, not on tree nodes.
 #define CALL_RPEEP(o) PL_rpeepp(aTHX_ o)
 #define CALL_OPFREEHOOK(o) if (PL_opfreehook) PL_opfreehook(aTHX_ o)
 
-static char array_passed_to_stat[] = "Array passed to stat will be coerced to a scalar";
+static const char array_passed_to_stat[] = "Array passed to stat will be coerced to a scalar";
 
 /* Used to avoid recursion through the op tree in scalarvoid() and
    op_free()
@@ -9751,7 +9751,7 @@ Perl_ck_ftst(pTHX_ OP *o)
             }
             else {
                 /* diag_listed_as: Array passed to stat will be coerced to a scalar%s */
-                Perl_warner(aTHX_ packWARN(WARN_SYNTAX), array_passed_to_stat);
+                Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "%s", array_passed_to_stat);
             }
        }
        scalar((OP *) kid);
@@ -10628,6 +10628,12 @@ Perl_ck_require(pTHX_ OP *o)
            s = SvPVX(sv);
            len = SvCUR(sv);
            end = s + len;
+            /* treat ::foo::bar as foo::bar */
+            if (len >= 2 && s[0] == ':' && s[1] == ':')
+                DIE(aTHX_ "Bareword in require must not start with a double-colon: \"%s\"\n", s);
+            if (s == end)
+                DIE(aTHX_ "Bareword in require maps to empty filename");
+
            for (; s < end; s++) {
                if (*s == ':' && s[1] == ':') {
                    *s = '/';