From: Rafael Garcia-Suarez Date: Tue, 24 Oct 2006 09:46:57 +0000 (+0000) Subject: No warning was produced if perl failed to load PerlIO::scalar X-Git-Tag: accepted/trunk/20130322.191538~16787 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75208dda88c67964167b44f78b4c8a0a93b6aa9c;p=platform%2Fupstream%2Fperl.git No warning was produced if perl failed to load PerlIO::scalar (contrary to other PerlIO layers.) p4raw-id: //depot/perl@29097 --- diff --git a/perlio.c b/perlio.c index 46d3176..06a360b 100644 --- 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