benoit wrote:


Stas Bekman wrote:
 >  From Changes:

=item 1.21_03 - March 15, 2000

new variable $Apache::Server::StrictPerlSections, if true, will croak
<Perl> section generates invalid Apache configuration syntax

Does it do the trick? I'm not sure why it's not documented.


Where should I put this?

startup.pl if it's loaded before perl sections or a simple <perl> section.

I've tried adding it in my single <perl> section, or even in a stand-alone block at the beginning of my httpd.conf, but if I intentionnally break my perl code, I come back with the problem I had, ie. a silent failing of httpd -X and a "could not bind to port 80" in the error_log.

As for the documentation of this feature, the "Practical mod_perl" book (which I love, btw!)

Thanks :)

says "if you set this variable to a true value [snip] then mod_perl will not tolerate invalid Apache configuration syntax and will croak if it encounters invalid syntax." So, it should croak only if one use un-localized variable name (which it seems to do by default).

No, no, it should croak on all errors. It's not an equivalent of 'use strict'. It's just a badly chosen name for this feature. Besides, in mp2 this won't be even an option. I totally fail to see why anybody will want to ignore a problem in the config file and continue regardless. Those who will want to trap the problem can use 'eval {} '.


But it's not a "padding" for possible _Perl_ syntax errors. Maybe now is the time when I should take my first peak under the hood of mod_perl, but I guess that those Perl sections are eval-ed, no? If it's the case, the @! could be catch and the error reported.

right. Enable tracing and you should see if there are any warnings/errors. Here is the code which you want to look at src/modules/perl/perl_config.c:


#define STRICT_PERL_SECTIONS_SV \
perl_get_sv("Apache::Server::StrictPerlSections", FALSE)

void perl_handle_command(cmd_parms *cmd, void *config, char *line)
{
    CHAR_P errmsg;
    SV *sv;

    MP_TRACE_s(fprintf(stderr, "handle_command (%s): ", line));
    if ((errmsg = handle_command(cmd, config, line))) {
        if ((sv = STRICT_PERL_SECTIONS_SV) && SvTRUE(sv)) {
            croak("<Perl>: %s", errmsg);
        }
        else {
            log_printf(cmd->server, "<Perl>: %s", errmsg);
        }
    }

    MP_TRACE_s(fprintf(stderr, "%s\n", errmsg ? errmsg : "OK"));
}

In mp2 <Perl> sections errors are fatal by default (will be shortly)



I'll try my broken configuration under mp2 when I'll find some time, to see how it behaves. I have'nt had time to play with it yet ; I'm just back in a mod_perl job after nearly 2 years of *gasp* PHP. :P

welcome home :)

--
__________________________________________________________________
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

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to