/*
* 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