stas 2004/02/09 10:21:36
Modified: src/modules/perl modperl_mgv.c . Changes Log: modperl_mgv_resolve now croaks when a module scheduled for autoloading fails to load. AutoLoaded modules shouldn't silently fail. Revision Changes Path 1.30 +13 -6 modperl-2.0/src/modules/perl/modperl_mgv.c Index: modperl_mgv.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -u -r1.29 -r1.30 --- modperl_mgv.c 15 Dec 2003 19:14:22 -0000 1.29 +++ modperl_mgv.c 9 Feb 2004 18:21:36 -0000 1.30 @@ -298,12 +298,11 @@ "package %s not in %INC, attempting to load '%s'\n", name, filename); - if (modperl_require_module(aTHX_ name, FALSE)) { + if (modperl_require_module(aTHX_ name, logfailure)) { MP_TRACE_h(MP_FUNC, "loaded %s package\n", name); } else { - MP_TRACE_h(MP_FUNC, "failed to load %s package\n", name); - return 0; + Perl_croak(aTHX_ "failed to load %s package\n", name); } } else { @@ -318,8 +317,7 @@ * module was loaded, preventing from loading the module */ if (!(stash || (stash = gv_stashpv(name, FALSE)))) { - MP_TRACE_h(MP_FUNC, "package %s seems to be loaded, " - "but can't find its stash\n", name); + MP_TRACE_h(MP_FUNC, "%s's stash is not found\n", name); return 0; } @@ -346,6 +344,14 @@ return 1; } + /* at least modperl_hash_handlers needs to verify that an + * autoloaded-marked handler needs to be loaded, since it doesn't + * check success failure, and handlers marked to be autoloaded are + * the same as PerlModule and the failure should be fatal */ + if (MpHandlerAUTOLOAD(handler)) { + Perl_croak(aTHX_ "failed to resolve handler %s\n", name); + } + #ifdef MP_TRACE /* complain only if the class was actually loaded/created */ if (stash) { @@ -417,7 +423,8 @@ } #endif -/* precompute the hash(es) for handler names */ +/* precompute the hash(es) for handler names, preload handlers + * configured to be autoloaded */ static void modperl_hash_handlers(pTHX_ apr_pool_t *p, server_rec *s, MpAV *entry, void *data) { 1.319 +3 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.318 retrieving revision 1.319 diff -u -u -r1.318 -r1.319 --- Changes 9 Feb 2004 18:18:16 -0000 1.318 +++ Changes 9 Feb 2004 18:21:36 -0000 1.319 @@ -12,6 +12,9 @@ =item 1.99_13-dev +modperl_mgv_resolve now croaks when a module scheduled for autoloading +fails to load. AutoLoaded modules shouldn't silently fail.[Stas] + Perl(Input|Output)FilterHandler handlers are now always AutoLoaded, as if '+' prefix was used. This must be performed to get the access to filter attributes long before the filter itself is executed. [Stas]