On Wed, 2004-01-21 at 23:33, Stas Bekman wrote: > Philippe, > > Adding this to httpd.conf: > > PerlModule Does::not::ExiST > > aborts the startup and prints the error message. > > The following section should be an equivalent one and behave the same: > > <Perl> > use Apache::ServerUtil; > my $s = Apache->server->add_config(['PerlModule Does::not::ExiST']); > </Perl> > > but it doesn't fail. By tracing through I can see that we simply return the > error message through add_config and expect the user to test for the error > message? Most people won't think of doing that and will scratch their heads in > mystery why things seem to be wrong, while the server has started. Besides it > makes the above two snippets which do the same thing behave differently.
yes, and is definitely _not_ intuitive. > I suggest to change add_config methods to return void, and croak on error. > Following is a partial patch w/o adjusting the return values to void. Yes, and if people want to ->add_config and know if it fails can just use an eval block. > Of course we still have the perlsections bug where a failing perlsection > doesn't prevent from the server to happily continue its starting, so that > croak below won't kill the server. it'd be very handy to get it fixed, hint, > hint ;) That is not a bug, it's a feature, or a documentation bug. That's what $Apache::Server::StrictPerlSections is for Notice that by default, perl sections _will_ print a warning (so with your croak patch): [warn] Syntax error at t/conf/extra.last.conf:74 Can't locate Does/not/ExiST.pm in @INC (@INC contains:[...]) at (eval 81) line 3. And if you set StrictPerlSections, you'll get a fatal error and the server startup will abort. AFAIK, the fact that a syntax error in a <Perl> sections in mp1 aborts server startup is a bug ... I would possibly suggest making Apache::Server::StrictPerlSections = 1 by default, maybe. But as far as having add_config croak on error, I think it's a good idea +1 > Index: src/modules/perl/modperl_config.c > =================================================================== > RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v > retrieving revision 1.74 > diff -u -r1.74 modperl_config.c > --- src/modules/perl/modperl_config.c 10 Jan 2004 02:52:20 -0000 1.74 > +++ src/modules/perl/modperl_config.c 22 Jan 2004 07:28:19 -0000 > @@ -452,6 +452,10 @@ > apr_pool_destroy(parms.temp_pool); > } > > + if (errmsg) { > + Perl_croak(aTHX_ "%s", errmsg); > + } > + > return errmsg; > } > > > __________________________________________________________________ > Stas Bekman JAm_pH ------> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com -- -------------------------------------------------------------------------------- Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B) http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5 Q: It is impossible to make anything foolproof because fools are so ingenious. perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
signature.asc
Description: This is a digitally signed message part