From: Nick Ing-Simmons Date: Mon, 29 Apr 2002 17:33:38 +0000 (+0000) Subject: Adding Encode::* to .pm creates stash at compile time X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc54c7994351acc5ef5bb312ef93ea76de59c190;p=p5sagit%2Fp5-mst-13.2.git Adding Encode::* to .pm creates stash at compile time which means we need a stronger check on Encode at boot time. p4raw-id: //depot/perlio@16270 --- diff --git a/ext/PerlIO/encoding/encoding.pm b/ext/PerlIO/encoding/encoding.pm index 327baeb..16a629c 100644 --- a/ext/PerlIO/encoding/encoding.pm +++ b/ext/PerlIO/encoding/encoding.pm @@ -12,7 +12,7 @@ $DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n"; use XSLoader (); XSLoader::load(__PACKAGE__, $VERSION); -our $fallback = Encode::PERLQQ()|Encode::WARN_ON_ERR; +our $fallback = Encode::PERLQQ()|Encode::WARN_ON_ERR(); 1; __END__ diff --git a/ext/PerlIO/encoding/encoding.xs b/ext/PerlIO/encoding/encoding.xs index 0a6ab10..038dd92 100644 --- a/ext/PerlIO/encoding/encoding.xs +++ b/ext/PerlIO/encoding/encoding.xs @@ -8,6 +8,8 @@ #include "XSUB.h" #define U8 U8 +#define OUR_DEFAULT_FB "Encode::PERLQQ" + #if defined(USE_PERLIO) && !defined(USE_SFIO) /* Define an encoding "layer" in the perliol.h sense. @@ -49,7 +51,6 @@ typedef struct { } PerlIOEncode; #define NEEDS_LINES 1 -#define OUR_DEFAULT_FB "Encode::PERLQQ" SV * PerlIOEncode_getarg(pTHX_ PerlIO * f, CLONE_PARAMS * param, int flags) @@ -615,7 +616,7 @@ BOOT: */ PUSHSTACKi(PERLSI_MAGIC); SPAGAIN; - if (!gv_stashpvn("Encode", 6, FALSE)) { + if (!get_cv(OUR_DEFAULT_FB, 0)) { #if 0 /* This would just be an irritant now loading works */ Perl_warner(aTHX_ packWARN(WARN_IO), ":encoding without 'use Encode'"); @@ -628,7 +629,6 @@ BOOT: SPAGAIN; LEAVE; } -#ifdef PERLIO_LAYERS PUSHMARK(sp); PUTBACK; if (call_pv(OUR_DEFAULT_FB, G_SCALAR) != 1) { @@ -638,6 +638,7 @@ BOOT: SPAGAIN; sv_setsv(chk, POPs); PUTBACK; +#ifdef PERLIO_LAYERS PerlIO_define_layer(aTHX_ &PerlIO_encode); #endif POPSTACK;