demand-load utf8.pm in swash routines
Gurusamy Sarathy [Thu, 9 Mar 2000 06:26:04 +0000 (06:26 +0000)]
p4raw-id: //depot/perl@5622

op.c
utf8.c

diff --git a/op.c b/op.c
index 689fc18..19be535 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5862,7 +5862,13 @@ Perl_ck_require(pTHX_ OP *o)
                    --SvCUR(kid->op_sv);
                }
            }
-           sv_catpvn(kid->op_sv, ".pm", 3);
+           if (SvREADONLY(kid->op_sv)) {
+               SvREADONLY_off(kid->op_sv);
+               sv_catpvn(kid->op_sv, ".pm", 3);
+               SvREADONLY_on(kid->op_sv);
+           }
+           else
+               sv_catpvn(kid->op_sv, ".pm", 3);
        }
     }
     return ck_fun(o);
diff --git a/utf8.c b/utf8.c
index ff113f9..212c555 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -670,6 +670,13 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none)
     SV* retval;
     char tmpbuf[256];
     dSP;    
+
+    if (!gv_stashpv(pkg, 0)) { /* demand load utf8 */
+       ENTER;
+       Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpv(pkg,0), Nullsv);
+       LEAVE;
+    }
+    SPAGAIN;
     PUSHSTACKi(PERLSI_MAGIC);
     PUSHMARK(SP);
     EXTEND(SP,5);