No warning was produced if perl failed to load PerlIO::scalar
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 24 Oct 2006 09:46:57 +0000 (09:46 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 24 Oct 2006 09:46:57 +0000 (09:46 +0000)
(contrary to other PerlIO layers.)

p4raw-id: //depot/perl@29097

perlio.c

index 46d3176..06a360b 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -1431,8 +1431,14 @@ PerlIO_layer_from_ref(pTHX_ SV *sv)
     /*
      * For any scalar type load the handler which is bundled with perl
      */
-    if (SvTYPE(sv) < SVt_PVAV)
-       return PerlIO_find_layer(aTHX_ STR_WITH_LEN("scalar"), 1);
+    if (SvTYPE(sv) < SVt_PVAV) {
+       PerlIO_funcs *f = PerlIO_find_layer(aTHX_ STR_WITH_LEN("scalar"), 1);
+       /* This isn't supposed to happen, since PerlIO::scalar is core,
+        * but could happen anyway in smaller installs or with PAR */
+       if (!f && ckWARN(WARN_LAYER))
+           Perl_warner(aTHX_ packWARN(WARN_LAYER), "Unknown PerlIO layer \"scalar\"");
+       return f;
+    }
 
     /*
      * For other types allow if layer is known but don't try and load it