You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@ectoplasm.org> on 2004/07/13 02:47:17 UTC

[Patch mp2] Deprecate $Apache::Server::StrictPerlSections in favor of a default of 1

Unless I am seriously mistaken, the consensus was to completely get rid of configurable
strictness for perlsections. Fix it at strict, and suggest using eval {} blocks if there
is a need _not_ to abort server-startup in the case of an exception.

Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.409
diff -u -I$Id -r1.409 Changes
--- Changes	12 Jul 2004 23:16:21 -0000	1.409
+++ Changes	13 Jul 2004 00:45:27 -0000
@@ -12,6 +12,10 @@

  =item 1.99_15-dev

+Deprecate $Apache::Server::StrictPerlSections. Now, all <Perl>
+sections are strict by default and cause server startup to
+abort on error. [Gozer]
+
  Fix ($r|$filter|$bucket)->read() functions to run the set magic logic,
  to handle cases when a passed buffer to fill is not a regular
  scalar. [Stas]
Index: docs/api/Apache/PerlSections.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/PerlSections.pod,v
retrieving revision 1.11
diff -u -I$Id -r1.11 PerlSections.pod
--- docs/api/Apache/PerlSections.pod	22 May 2004 02:03:27 -0000	1.11
+++ docs/api/Apache/PerlSections.pod	13 Jul 2004 00:45:27 -0000
@@ -148,17 +148,6 @@



-=head2 C<$Apache::Server::StrictPerlSections>
-
-By default, compilation and run-time errors within C<E<lt>Perl E<gt>>
-sections will cause a warning to be printed in the error_log. By
-setting this variable to a true value, code in the sections will be
-evaluated as if "use strict" was in usage, and all warning and errors
-will cause the server to abort startup and report the first error.
-
-
-
-
  =head1 PerlSections dumping

  =head2 Apache::PerlSections-E<gt>dump
Index: docs/user/porting/compat.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/porting/compat.pod,v
retrieving revision 1.55
diff -u -I$Id -r1.55 compat.pod
--- docs/user/porting/compat.pod	7 Jul 2004 21:52:25 -0000	1.55
+++ docs/user/porting/compat.pod	13 Jul 2004 00:45:27 -0000
@@ -84,6 +84,13 @@
        PerlFreshRestart
    </IfDefine>

+=head2 C<$Apache::Server::StrictPerlSections>
+
+In mod_perl 2.0, C<L<E<lt>PerlE<gt>|docs::2.0::api::Apache::PerlSections>>
+sections are now always strict. Any error in them will cause an immediate
+server startup abort, dumping the error to stderr. To avoid this, eval blocks
+can be used to trap errors and ignore them.
+
  =head2 Apache Configuration Customization

  mod_perl 2.0 has slightly changed the mechanism for L<adding custom
Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.60
diff -u -I$Id -r1.60 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c	16 Jun 2004 03:55:47 -0000	1.60
+++ src/modules/perl/modperl_cmd.c	13 Jul 2004 00:45:27 -0000
@@ -463,8 +463,6 @@

  #define MP_DEFAULT_PERLSECTION_HANDLER "Apache::PerlSections"
  #define MP_DEFAULT_PERLSECTION_PACKAGE "Apache::ReadConfig"
-#define MP_STRICT_PERLSECTIONS_SV \
-    get_sv("Apache::Server::StrictPerlSections", FALSE)
  #define MP_PERLSECTIONS_SAVECONFIG_SV \
      get_sv("Apache::Server::SaveConfig", FALSE)

@@ -540,18 +538,8 @@
      }

      if (SvTRUE(ERRSV)) {
-        SV *strict = MP_STRICT_PERLSECTIONS_SV;
-        if (strict && SvTRUE(strict)) {
-            char *error = SvPVX(ERRSV);
-            MP_PERL_RESTORE_CONTEXT;
-            return error;
-        }
-        else {
-            modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d %s",
-                                             directive->filename,
-                                             directive->line_num,
-                                             SvPVX(ERRSV)));
-        }
+        MP_PERL_RESTORE_CONTEXT;
+        return SvPVX(ERRSV);
      }

      if (handler) {
Index: todo/release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.30
diff -u -I$Id -r1.30 release
--- todo/release	5 Jul 2004 22:02:42 -0000	1.30
+++ todo/release	13 Jul 2004 00:45:28 -0000
@@ -69,10 +69,6 @@
    http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=106074969831522&w=2
    owner: gozer

-* $Apache::Server::StrictPerlSections should be 1 by default (and docs
-  updated)
-  owner: gozer
-
  * Fixing Apache->warn("foo")

    Report: http://mathforum.org/epigone/modperl-dev/noxtramcay/3D11A4E5.6010202@stason.org

-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Re: [Patch mp2] Deprecate $Apache::Server::StrictPerlSections in favor of a default of 1

Posted by Stas Bekman <st...@stason.org>.
> Good point ;-)

+1

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch mp2] Deprecate $Apache::Server::StrictPerlSections in favor of a default of 1

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.

Stas Bekman wrote:
> Stas Bekman wrote:
> 
>>Philippe M. Chiasson wrote:
>>
>>
>>>Unless I am seriously mistaken, the consensus was to completely get 
>>>rid of configurable
>>>strictness for perlsections. Fix it at strict, and suggest using eval 
>>>{} blocks if there
>>>is a need _not_ to abort server-startup in the case of an exception.
>>
>>
>>+1 with a few non-code related comments.
>>
>>
>>>Index: Changes
>>>===================================================================
>>>RCS file: /home/cvs/modperl-2.0/Changes,v
>>>retrieving revision 1.409
>>>diff -u -I$Id -r1.409 Changes
>>>--- Changes    12 Jul 2004 23:16:21 -0000    1.409
>>>+++ Changes    13 Jul 2004 00:45:27 -0000
>>>@@ -12,6 +12,10 @@
>>>
>>> =item 1.99_15-dev
>>>
>>>+Deprecate $Apache::Server::StrictPerlSections. Now, all <Perl>
>>>+sections are strict by default and cause server startup to
>>>+abort on error. [Gozer]
>>
>>
>>not deprecated, but removed.
> 
> 
> and not strict, but "errors-are-fatal' :)

Good point ;-)

Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.409
diff -u -I$Id -r1.409 Changes
--- Changes	12 Jul 2004 23:16:21 -0000	1.409
+++ Changes	13 Jul 2004 01:08:34 -0000
@@ -12,6 +12,10 @@

  =item 1.99_15-dev

+Remove $Apache::Server::StrictPerlSections. Now, all <Perl>
+sections errors are fatal by default and cause server startup to
+abort on error. [Gozer]
+
  Fix ($r|$filter|$bucket)->read() functions to run the set magic logic,
  to handle cases when a passed buffer to fill is not a regular
  scalar. [Stas]
Index: docs/api/Apache/PerlSections.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/PerlSections.pod,v
retrieving revision 1.11
diff -u -I$Id -r1.11 PerlSections.pod
--- docs/api/Apache/PerlSections.pod	22 May 2004 02:03:27 -0000	1.11
+++ docs/api/Apache/PerlSections.pod	13 Jul 2004 01:08:34 -0000
@@ -148,17 +148,6 @@



-=head2 C<$Apache::Server::StrictPerlSections>
-
-By default, compilation and run-time errors within C<E<lt>Perl E<gt>>
-sections will cause a warning to be printed in the error_log. By
-setting this variable to a true value, code in the sections will be
-evaluated as if "use strict" was in usage, and all warning and errors
-will cause the server to abort startup and report the first error.
-
-
-
-
  =head1 PerlSections dumping

  =head2 Apache::PerlSections-E<gt>dump
Index: docs/user/porting/compat.pod
===================================================================
RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/porting/compat.pod,v
retrieving revision 1.55
diff -u -I$Id -r1.55 compat.pod
--- docs/user/porting/compat.pod	7 Jul 2004 21:52:25 -0000	1.55
+++ docs/user/porting/compat.pod	13 Jul 2004 01:08:34 -0000
@@ -84,6 +84,14 @@
        PerlFreshRestart
    </IfDefine>

+=head2 C<$Apache::Server::StrictPerlSections>
+
+In mod_perl 2.0, C<L<E<lt>PerlE<gt>|docs::2.0::api::Apache::PerlSections>>
+sections errors are now always fatal. Any error in them will cause an immediate
+server startup abort, dumping the error to stderr. To avoid this, C<eval {}>
+can be used to trap errors and ignore them. In mod_perl 1, 'strict' was
+somewhat of a misnomer.
+
  =head2 Apache Configuration Customization

  mod_perl 2.0 has slightly changed the mechanism for L<adding custom
Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.60
diff -u -I$Id -r1.60 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c	16 Jun 2004 03:55:47 -0000	1.60
+++ src/modules/perl/modperl_cmd.c	13 Jul 2004 01:08:34 -0000
@@ -463,8 +463,6 @@

  #define MP_DEFAULT_PERLSECTION_HANDLER "Apache::PerlSections"
  #define MP_DEFAULT_PERLSECTION_PACKAGE "Apache::ReadConfig"
-#define MP_STRICT_PERLSECTIONS_SV \
-    get_sv("Apache::Server::StrictPerlSections", FALSE)
  #define MP_PERLSECTIONS_SAVECONFIG_SV \
      get_sv("Apache::Server::SaveConfig", FALSE)

@@ -540,18 +538,8 @@
      }

      if (SvTRUE(ERRSV)) {
-        SV *strict = MP_STRICT_PERLSECTIONS_SV;
-        if (strict && SvTRUE(strict)) {
-            char *error = SvPVX(ERRSV);
-            MP_PERL_RESTORE_CONTEXT;
-            return error;
-        }
-        else {
-            modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d %s",
-                                             directive->filename,
-                                             directive->line_num,
-                                             SvPVX(ERRSV)));
-        }
+        MP_PERL_RESTORE_CONTEXT;
+        return SvPVX(ERRSV);
      }

      if (handler) {
Index: todo/release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.30
diff -u -I$Id -r1.30 release
--- todo/release	5 Jul 2004 22:02:42 -0000	1.30
+++ todo/release	13 Jul 2004 01:08:34 -0000
@@ -69,10 +69,6 @@
    http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=106074969831522&w=2
    owner: gozer

-* $Apache::Server::StrictPerlSections should be 1 by default (and docs
-  updated)
-  owner: gozer
-
  * Fixing Apache->warn("foo")

    Report: http://mathforum.org/epigone/modperl-dev/noxtramcay/3D11A4E5.6010202@stason.org


-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Re: [Patch mp2] Deprecate $Apache::Server::StrictPerlSections in favor of a default of 1

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>> Unless I am seriously mistaken, the consensus was to completely get 
>> rid of configurable
>> strictness for perlsections. Fix it at strict, and suggest using eval 
>> {} blocks if there
>> is a need _not_ to abort server-startup in the case of an exception.
> 
> 
> +1 with a few non-code related comments.
> 
>> Index: Changes
>> ===================================================================
>> RCS file: /home/cvs/modperl-2.0/Changes,v
>> retrieving revision 1.409
>> diff -u -I$Id -r1.409 Changes
>> --- Changes    12 Jul 2004 23:16:21 -0000    1.409
>> +++ Changes    13 Jul 2004 00:45:27 -0000
>> @@ -12,6 +12,10 @@
>>
>>  =item 1.99_15-dev
>>
>> +Deprecate $Apache::Server::StrictPerlSections. Now, all <Perl>
>> +sections are strict by default and cause server startup to
>> +abort on error. [Gozer]
> 
> 
> not deprecated, but removed.

and not strict, but "errors-are-fatal' :)

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch mp2] Deprecate $Apache::Server::StrictPerlSections in favor of a default of 1

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Unless I am seriously mistaken, the consensus was to completely get rid 
> of configurable
> strictness for perlsections. Fix it at strict, and suggest using eval {} 
> blocks if there
> is a need _not_ to abort server-startup in the case of an exception.

+1 with a few non-code related comments.

> Index: Changes
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/Changes,v
> retrieving revision 1.409
> diff -u -I$Id -r1.409 Changes
> --- Changes    12 Jul 2004 23:16:21 -0000    1.409
> +++ Changes    13 Jul 2004 00:45:27 -0000
> @@ -12,6 +12,10 @@
> 
>  =item 1.99_15-dev
> 
> +Deprecate $Apache::Server::StrictPerlSections. Now, all <Perl>
> +sections are strict by default and cause server startup to
> +abort on error. [Gozer]

not deprecated, but removed.

> Index: docs/user/porting/compat.pod
> ===================================================================
> RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/porting/compat.pod,v
> retrieving revision 1.55
> diff -u -I$Id -r1.55 compat.pod
> --- docs/user/porting/compat.pod    7 Jul 2004 21:52:25 -0000    1.55
> +++ docs/user/porting/compat.pod    13 Jul 2004 00:45:27 -0000
> @@ -84,6 +84,13 @@
>        PerlFreshRestart
>    </IfDefine>
> 
> +=head2 C<$Apache::Server::StrictPerlSections>
> +
> +In mod_perl 2.0, C<L<E<lt>PerlE<gt>|docs::2.0::api::Apache::PerlSections>>
> +sections are now always strict. Any error in them will cause an immediate

s/strict/fatal/. You may want to add a comment that 'strict' was a 
misnomer in mp1.

> +server startup abort, dumping the error to stderr. To avoid this, eval 
> blocks
> +can be used to trap errors and ignore them.

there is no 'blocks', better: s/eval blocks/C<eval {}>/


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org