summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-01-22 17:43:45 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-01-22 17:43:45 +0000
commit0555b2b0658b3543d19d3fed65724628f43e0191 (patch)
tree8a063c6e16d6c7c8a27c447eada7f9ea8df31b83 /perlio.c
parentfa6f41cfedcd9c19e472d10292b6d4367aa3b9b0 (diff)
parentc9bca74aca217023baf0f921dcffaaa072a83cf3 (diff)
downloadperl-0555b2b0658b3543d19d3fed65724628f43e0191.tar.gz
Integrate from perlio:
[ 18560] Fixes for open.pm which attempts to load layers: 1. C equivalent of local $SIG{__WARN__} = sub {} while loading layers to supress warnings lib/open.t does not want. 2. The loading scheme does not recurse now so look for new symptom of bad layer which is that a good module fails to load (as we cannot open any files). NOTE: In my opinion open.pm should probably die on bad layer spec rather than just (maybe) warning and then allowing opens to fail. p4raw-link: @18560 on //depot/perlio: c9bca74aca217023baf0f921dcffaaa072a83cf3 p4raw-id: //depot/perl@18561
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/perlio.c b/perlio.c
index 79f75d3014..e6de36f29a 100644
--- a/perlio.c
+++ b/perlio.c
@@ -666,8 +666,13 @@ PerlIO_find_layer(pTHX_ const char *name, STRLEN len, int load)
} else {
SV *pkgsv = newSVpvn("PerlIO", 6);
SV *layer = newSVpvn(name, len);
- ENTER;
+ CV *cv = get_cv("PerlIO::Layer::NoWarnings", FALSE);
+ ENTER;
SAVEINT(PL_in_load_module);
+ if (cv) {
+ SAVESPTR(PL_warnhook);
+ PL_warnhook = (SV *) cv;
+ }
PL_in_load_module++;
/*
* The two SVs are magically freed by load_module
@@ -770,6 +775,17 @@ PerlIO_tab_sv(pTHX_ PerlIO_funcs *tab)
return sv;
}
+XS(XS_PerlIO__Layer__NoWarnings)
+{
+ /* This is used as a %SIG{__WARN__} handler to supress warnings
+ during loading of layers.
+ */
+ dXSARGS;
+ if (items)
+ PerlIO_debug("warning:%s\n",SvPV_nolen(ST(0)));
+ XSRETURN(0);
+}
+
XS(XS_PerlIO__Layer__find)
{
dXSARGS;
@@ -1012,6 +1028,7 @@ Perl_boot_core_PerlIO(pTHX)
__FILE__);
#endif
newXS("PerlIO::Layer::find", XS_PerlIO__Layer__find, __FILE__);
+ newXS("PerlIO::Layer::NoWarnings", XS_PerlIO__Layer__NoWarnings, __FILE__);
}
PerlIO_funcs *