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/06/28 22:44:00 UTC

[mp2 Patch] Make sections strict by default

As has been requested for quite a while, this patch _finally_ makes <Perl> sections
strict by default.

Index: todo/release
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/release,v
retrieving revision 1.29
diff -u -I$Id -r1.29 release
--- todo/release	9 Jun 2004 14:46:22 -0000	1.29
+++ todo/release	28 Jun 2004 20:42:57 -0000
@@ -74,10 +74,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
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.392
diff -u -I$Id -r1.392 Changes
--- Changes	27 Jun 2004 21:26:45 -0000	1.392
+++ Changes	28 Jun 2004 20:42:58 -0000
@@ -12,6 +12,9 @@

  =item 1.99_15-dev

+<Perl> sections are now strict by default and can be disabled by
+setting $Apache::Server::StrictPerlSections = 0; [Gozer]
+
  Registry: remove the misleading prefix "$$: $class:" in the logged
  error message, since not only registry errors will get logged if $@ is
  set [Stas]
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	28 Jun 2004 20:42:58 -0000
@@ -541,16 +541,16 @@

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


-- 
--------------------------------------------------------------------------------
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: [mp2 Patch] Make sections strict by default

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> 
> 
> Stas Bekman wrote:
> 
>>>> Also, these two: $Apache::Server::SaveConfig, 
>>>> $Apache::Server::StrictPerlSections need to move to the package they 
>>>> belong to. Which is Apache::PerlSections::. And you can now call it:
>>>> Apache::PerlSections::Strict. But that's a separate issue.
>>>
>>>
>>>
>>> I'll change those names sepraratly in just a moment, it does make 
>>> much more sense.
>>
>>
>>
>> cool. As Apache::Server is really no more at the moment. (moved to 
>> ServerRec)
>>
>>
>>> But in regards to the strict perl sections issue, what are we doing 
>>> about it?
>>>
>>> $Apache::Server::StrictPerlSections
>>>  * Get rid of it ?
>>>  * Keep it only when MP_COMPAT_1X=1
>>>  * Warn about it being deprecated in favor of eval {}
>>>
>>> $Apache::PerlSections::Strict on by default, and optionnaly 
>>> disableable ?
>>
>>
>>
>> Suggestion:
>>
>> Get rid of it completely, not even with compat or MP_COMPAT_1X. Those 
>> who will want to try to reuse 1.x and 2.x config file, can add eval {} 
>> in their 1.x setup and remove $Apache::Server::StrictPerlSections in 
>> mp1. document that in porting/compat.pod.
> 
> 
> So, this would also mean no $Apache::PerlSections::Strict either ?

Nope, IMHO


-- 
__________________________________________________________________
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: [mp2 Patch] Make sections strict by default

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

Stas Bekman wrote:
>>>Also, these two: $Apache::Server::SaveConfig, 
>>>$Apache::Server::StrictPerlSections need to move to the package they 
>>>belong to. Which is Apache::PerlSections::. And you can now call it:
>>>Apache::PerlSections::Strict. But that's a separate issue.
>>
>>
>>I'll change those names sepraratly in just a moment, it does make much 
>>more sense.
> 
> 
> cool. As Apache::Server is really no more at the moment. (moved to 
> ServerRec)
> 
> 
>>But in regards to the strict perl sections issue, what are we doing 
>>about it?
>>
>>$Apache::Server::StrictPerlSections
>>  * Get rid of it ?
>>  * Keep it only when MP_COMPAT_1X=1
>>  * Warn about it being deprecated in favor of eval {}
>>
>>$Apache::PerlSections::Strict on by default, and optionnaly disableable ?
> 
> 
> Suggestion:
> 
> Get rid of it completely, not even with compat or MP_COMPAT_1X. Those 
> who will want to try to reuse 1.x and 2.x config file, can add eval {} 
> in their 1.x setup and remove $Apache::Server::StrictPerlSections in 
> mp1. document that in porting/compat.pod.

So, this would also mean no $Apache::PerlSections::Strict either ?


-- 
--------------------------------------------------------------------------------
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: [mp2 Patch] Make sections strict by default

Posted by Stas Bekman <st...@stason.org>.
>> Also, these two: $Apache::Server::SaveConfig, 
>> $Apache::Server::StrictPerlSections need to move to the package they 
>> belong to. Which is Apache::PerlSections::. And you can now call it:
>> Apache::PerlSections::Strict. But that's a separate issue.
> 
> 
> I'll change those names sepraratly in just a moment, it does make much 
> more sense.

cool. As Apache::Server is really no more at the moment. (moved to 
ServerRec)

> But in regards to the strict perl sections issue, what are we doing 
> about it?
> 
> $Apache::Server::StrictPerlSections
>   * Get rid of it ?
>   * Keep it only when MP_COMPAT_1X=1
>   * Warn about it being deprecated in favor of eval {}
> 
> $Apache::PerlSections::Strict on by default, and optionnaly disableable ?

Suggestion:

Get rid of it completely, not even with compat or MP_COMPAT_1X. Those 
who will want to try to reuse 1.x and 2.x config file, can add eval {} 
in their 1.x setup and remove $Apache::Server::StrictPerlSections in 
mp1. document that in porting/compat.pod.

-- 
__________________________________________________________________
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: [mp2 Patch] Make sections strict by default

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

Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>>
>>Stas Bekman wrote:
>>
>>
>>>Philippe M. Chiasson wrote:
>>>
>>>
>>>>Stas Bekman wrote:
>>>>
>>>>
>>>>
>>>>>Philippe M. Chiasson wrote:
>>>>>[...]
>>>>>
>>>>>
>>>>>
>>>>>>>Moreover now that I think about it I'm not quite sure why in the 
>>>>>>>world someone will want to turn this feature on. Can you please 
>>>>>>>remind me why was it added at all? If someone wants that badly 
>>>>>>>then can just wrap the whole section in the eval {}  block.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>As far as I can tell/remember, this is simply a mp1 feature that I 
>>>>>>wanted to
>>>>>>preserve when porting the <Perl> code to mp2.
>>>>>>
>>>>>>I agree that it doesn't add much functionnality that an eval {} 
>>>>>>block wouldn't
>>>>>>allow (except maybe if the code _doesn't_ compile at all.
>>>>>>
>>>>>>How about this?
>>>>>>- Implement PerlSectionsNonFatal = 1
>>>>>>- Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X 
>>>>>>is selected ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>If we agree that it has no real added value then we don't want it at 
>>>>>all.
>>>>
>>>>
>>>>
>>>>Unless somebody can come up with a good reason why we need it, I am 
>>>>quite
>>>>happy getting rid of this 'feature'
>>>
>>>
>>>
>>>I guess you could check the list archives to see why was it added in 
>>>first place? Doug is known not to add useless features. Quite possible 
>>>that we miss the reason.
>>>
>>
>>How about for now we keep things the way they stand when MP_COMPAT_1X=1, 
>>and just
>>deprecate it all, making <Perl> sections strict _always_ and if people 
>>want errors
>>not to abort startup, just use eval {} ?
> 
> 
> Yes, but, MP_COMPAT_1X=1 is the default, so your change accomplishes 
> nothing for this default value. We still remain with non-strict sections 
> by default, no?

Correct, I just realized that MP_COMPAT_1X was on by default, dhu.

> Also, these two: $Apache::Server::SaveConfig, 
> $Apache::Server::StrictPerlSections need to move to the package they 
> belong to. Which is Apache::PerlSections::. And you can now call it:
> Apache::PerlSections::Strict. But that's a separate issue.

I'll change those names sepraratly in just a moment, it does make much more sense.

But in regards to the strict perl sections issue, what are we doing about it?

$Apache::Server::StrictPerlSections
   * Get rid of it ?
   * Keep it only when MP_COMPAT_1X=1
   * Warn about it being deprecated in favor of eval {}

$Apache::PerlSections::Strict on by default, and optionnaly disableable ?


> 

-- 
--------------------------------------------------------------------------------
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: [mp2 Patch] Make sections strict by default

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> 
> 
> Stas Bekman wrote:
> 
>> Philippe M. Chiasson wrote:
>>
>>>
>>> Stas Bekman wrote:
>>>
>>>
>>>> Philippe M. Chiasson wrote:
>>>> [...]
>>>>
>>>>
>>>>>> Moreover now that I think about it I'm not quite sure why in the 
>>>>>> world someone will want to turn this feature on. Can you please 
>>>>>> remind me why was it added at all? If someone wants that badly 
>>>>>> then can just wrap the whole section in the eval {}  block.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> As far as I can tell/remember, this is simply a mp1 feature that I 
>>>>> wanted to
>>>>> preserve when porting the <Perl> code to mp2.
>>>>>
>>>>> I agree that it doesn't add much functionnality that an eval {} 
>>>>> block wouldn't
>>>>> allow (except maybe if the code _doesn't_ compile at all.
>>>>>
>>>>> How about this?
>>>>> - Implement PerlSectionsNonFatal = 1
>>>>> - Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X 
>>>>> is selected ?
>>>>
>>>>
>>>>
>>>>
>>>> If we agree that it has no real added value then we don't want it at 
>>>> all.
>>>
>>>
>>>
>>> Unless somebody can come up with a good reason why we need it, I am 
>>> quite
>>> happy getting rid of this 'feature'
>>
>>
>>
>> I guess you could check the list archives to see why was it added in 
>> first place? Doug is known not to add useless features. Quite possible 
>> that we miss the reason.
>>
> 
> How about for now we keep things the way they stand when MP_COMPAT_1X=1, 
> and just
> deprecate it all, making <Perl> sections strict _always_ and if people 
> want errors
> not to abort startup, just use eval {} ?

Yes, but, MP_COMPAT_1X=1 is the default, so your change accomplishes 
nothing for this default value. We still remain with non-strict sections 
by default, no?

Also, these two: $Apache::Server::SaveConfig, 
$Apache::Server::StrictPerlSections need to move to the package they 
belong to. Which is Apache::PerlSections::. And you can now call it:
Apache::PerlSections::Strict. But that's a separate issue.


-- 
__________________________________________________________________
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: [mp2 Patch] Make sections strict by default

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

Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>>
>>Stas Bekman wrote:
>>
>>
>>>Philippe M. Chiasson wrote:
>>>[...]
>>>
>>>
>>>>>Moreover now that I think about it I'm not quite sure why in the 
>>>>>world someone will want to turn this feature on. Can you please 
>>>>>remind me why was it added at all? If someone wants that badly then 
>>>>>can just wrap the whole section in the eval {}  block.
>>>>
>>>>
>>>>
>>>>As far as I can tell/remember, this is simply a mp1 feature that I 
>>>>wanted to
>>>>preserve when porting the <Perl> code to mp2.
>>>>
>>>>I agree that it doesn't add much functionnality that an eval {} block 
>>>>wouldn't
>>>>allow (except maybe if the code _doesn't_ compile at all.
>>>>
>>>>How about this?
>>>>- Implement PerlSectionsNonFatal = 1
>>>>- Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X is 
>>>>selected ?
>>>
>>>
>>>
>>>If we agree that it has no real added value then we don't want it at all.
>>
>>
>>Unless somebody can come up with a good reason why we need it, I am quite
>>happy getting rid of this 'feature'
> 
> 
> I guess you could check the list archives to see why was it added in first 
> place? Doug is known not to add useless features. Quite possible that we miss 
> the reason.
> 

How about for now we keep things the way they stand when MP_COMPAT_1X=1, and just
deprecate it all, making <Perl> sections strict _always_ and if people want errors
not to abort startup, just use eval {} ?

Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.408
diff -u -I$Id -r1.408 Changes
--- Changes	12 Jul 2004 07:32:07 -0000	1.408
+++ Changes	12 Jul 2004 19:23:10 -0000
@@ -12,6 +12,9 @@

  =item 1.99_15-dev

+Deprecate $Apache::Server::StrictPerlSections when MP_COMPAT_1X=0 and
+make <Perl> sections errors abort server startup [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	12 Jul 2004 19:23:10 -0000
@@ -150,11 +150,14 @@

  =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.
+This variable has been deprecated in 2.0, but is still available for
+backwards compatibility with mod_perl 1.0 unless 2.0 was built with
+C<L<MP_COMPAT_1X=0|docs::2.0::user::install::install/MP_COMPAT_1X>>.
+
+Now, by default, compilation and run-time errors within C<E<lt>Perl E<gt>>
+sections will cause the server to abort startup and report the first error.
+
+



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	12 Jul 2004 19:23:10 -0000
@@ -540,18 +540,22 @@
      }

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

      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	12 Jul 2004 19:23:10 -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: [mp2 Patch] Make sections strict by default

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> 
> 
> Stas Bekman wrote:
> 
>> Philippe M. Chiasson wrote:
>> [...]
>>
>>>> Moreover now that I think about it I'm not quite sure why in the 
>>>> world someone will want to turn this feature on. Can you please 
>>>> remind me why was it added at all? If someone wants that badly then 
>>>> can just wrap the whole section in the eval {}  block.
>>>
>>>
>>>
>>> As far as I can tell/remember, this is simply a mp1 feature that I 
>>> wanted to
>>> preserve when porting the <Perl> code to mp2.
>>>
>>> I agree that it doesn't add much functionnality that an eval {} block 
>>> wouldn't
>>> allow (except maybe if the code _doesn't_ compile at all.
>>>
>>> How about this?
>>> - Implement PerlSectionsNonFatal = 1
>>> - Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X is 
>>> selected ?
>>
>>
>>
>> If we agree that it has no real added value then we don't want it at all.
> 
> 
> Unless somebody can come up with a good reason why we need it, I am quite
> happy getting rid of this 'feature'

I guess you could check the list archives to see why was it added in first 
place? Doug is known not to add useless features. Quite possible that we miss 
the reason.


-- 
__________________________________________________________________
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: [mp2 Patch] Make sections strict by default

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

Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> [...]
> 
>>>Moreover now that I think about it I'm not quite sure why in the world 
>>>someone will want to turn this feature on. Can you please remind me 
>>>why was it added at all? If someone wants that badly then can just 
>>>wrap the whole section in the eval {}  block.
>>
>>
>>As far as I can tell/remember, this is simply a mp1 feature that I 
>>wanted to
>>preserve when porting the <Perl> code to mp2.
>>
>>I agree that it doesn't add much functionnality that an eval {} block 
>>wouldn't
>>allow (except maybe if the code _doesn't_ compile at all.
>>
>>How about this?
>> - Implement PerlSectionsNonFatal = 1
>> - Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X is 
>>selected ?
> 
> 
> If we agree that it has no real added value then we don't want it at all.

Unless somebody can come up with a good reason why we need it, I am quite
happy getting rid of this 'feature'

> Though if we want to have it for backward compat, then we better keep the same 
> name.
> 
> So, +1 to keep the name and do have it only for MP_COMPAT_1X

Will do that then, expect revised patch.

> Next it'd be nice to remove the mentioning of it in
> src/docs/2.0/api.orig/Apache/PerlSections.pod and move it to 
> user/porting/compat.pod. We shouldn't even mention backcompat features in the 
> normal docs - only in the compat.pod.

Sounds good.

> 
> 

-- 
--------------------------------------------------------------------------------
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: [mp2 Patch] Make sections strict by default

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
[...]
>> Moreover now that I think about it I'm not quite sure why in the world 
>> someone will want to turn this feature on. Can you please remind me 
>> why was it added at all? If someone wants that badly then can just 
>> wrap the whole section in the eval {}  block.
> 
> 
> As far as I can tell/remember, this is simply a mp1 feature that I 
> wanted to
> preserve when porting the <Perl> code to mp2.
> 
> I agree that it doesn't add much functionnality that an eval {} block 
> wouldn't
> allow (except maybe if the code _doesn't_ compile at all.
> 
> How about this?
>  - Implement PerlSectionsNonFatal = 1
>  - Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X is 
> selected ?

If we agree that it has no real added value then we don't want it at all.

Though if we want to have it for backward compat, then we better keep the same 
name.

So, +1 to keep the name and do have it only for MP_COMPAT_1X

Next it'd be nice to remove the mentioning of it in
src/docs/2.0/api.orig/Apache/PerlSections.pod and move it to 
user/porting/compat.pod. We shouldn't even mention backcompat features in the 
normal docs - only in the compat.pod.



-- 
__________________________________________________________________
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: [mp2 Patch] Make sections strict by default

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>>As has been requested for quite a while, this patch _finally_ makes 
>><Perl> sections
>>strict by default.
>>
>>Index: todo/release
>>===================================================================
>>RCS file: /home/cvs/modperl-2.0/todo/release,v
>>retrieving revision 1.29
>>diff -u -I$Id -r1.29 release
>>--- todo/release    9 Jun 2004 14:46:22 -0000    1.29
>>+++ todo/release    28 Jun 2004 20:42:57 -0000
>>@@ -74,10 +74,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 
>>
>>Index: Changes
>>===================================================================
>>RCS file: /home/cvs/modperl-2.0/Changes,v
>>retrieving revision 1.392
>>diff -u -I$Id -r1.392 Changes
>>--- Changes    27 Jun 2004 21:26:45 -0000    1.392
>>+++ Changes    28 Jun 2004 20:42:58 -0000
>>@@ -12,6 +12,9 @@
>>
>> =item 1.99_15-dev
>>
>>+<Perl> sections are now strict by default and can be disabled by
>>+setting $Apache::Server::StrictPerlSections = 0; [Gozer]
> 
> 
> I think we need to choose a better name for StrictPerlSections. "Strict" 
> implies 'use strict' to most perl users, so it's a misleading name. Also may 
> be it's better to have the feature name as a prefix and the sub-feature as a 
> postfix. i.e. $Apache::Server::PerlSectionsStrict. For example use 
> $Apache::Server::PerlSectionsNonFatal (not reversed logic), so only when it's 
> set to 1, the errors will be non-fatal.

I like $Apache::Server::PerlSectionsNonFatal = 1;

> Moreover now that I think about it I'm not quite sure why in the world someone 
> will want to turn this feature on. Can you please remind me why was it added 
> at all? If someone wants that badly then can just wrap the whole section in 
> the eval {}  block.

As far as I can tell/remember, this is simply a mp1 feature that I wanted to
preserve when porting the <Perl> code to mp2.

I agree that it doesn't add much functionnality that an eval {} block wouldn't
allow (except maybe if the code _doesn't_ compile at all.

How about this?
  - Implement PerlSectionsNonFatal = 1
  - Deprecate StrictPerlSections with a warning, unless MP_COMPAT_1X is selected ?

> Also here:
> 
> 
>>             modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d 
>>%s",
>>                                              directive->filename,
>>                                              directive->line_num,
>>                                              SvPVX(ERRSV)));
> 
> 
> we should probably drop the word: Syntax, since it can be pretty much any 
> error. Moreover the order of elements in the error is different from perl (and 
> here we give a perl error). So I suggest:
> 
>               modperl_log_warn(s, apr_psprintf(p, "%s at %s line %d",
>                                                SvPVX(ERRSV),
>                                                directive->filename,
>                                                directive->line_num));
> 
> but may be it's totally irrelevant if we drop that feature completely.
> 

-- 
--------------------------------------------------------------------------------
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: [mp2 Patch] Make sections strict by default

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> As has been requested for quite a while, this patch _finally_ makes 
> <Perl> sections
> strict by default.
> 
> Index: todo/release
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/todo/release,v
> retrieving revision 1.29
> diff -u -I$Id -r1.29 release
> --- todo/release    9 Jun 2004 14:46:22 -0000    1.29
> +++ todo/release    28 Jun 2004 20:42:57 -0000
> @@ -74,10 +74,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 
> 
> Index: Changes
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/Changes,v
> retrieving revision 1.392
> diff -u -I$Id -r1.392 Changes
> --- Changes    27 Jun 2004 21:26:45 -0000    1.392
> +++ Changes    28 Jun 2004 20:42:58 -0000
> @@ -12,6 +12,9 @@
> 
>  =item 1.99_15-dev
> 
> +<Perl> sections are now strict by default and can be disabled by
> +setting $Apache::Server::StrictPerlSections = 0; [Gozer]

I think we need to choose a better name for StrictPerlSections. "Strict" 
implies 'use strict' to most perl users, so it's a misleading name. Also may 
be it's better to have the feature name as a prefix and the sub-feature as a 
postfix. i.e. $Apache::Server::PerlSectionsStrict. For example use 
$Apache::Server::PerlSectionsNonFatal (not reversed logic), so only when it's 
set to 1, the errors will be non-fatal.

Moreover now that I think about it I'm not quite sure why in the world someone 
will want to turn this feature on. Can you please remind me why was it added 
at all? If someone wants that badly then can just wrap the whole section in 
the eval {}  block.

Also here:

>              modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d 
> %s",
>                                               directive->filename,
>                                               directive->line_num,
>                                               SvPVX(ERRSV)));

we should probably drop the word: Syntax, since it can be pretty much any 
error. Moreover the order of elements in the error is different from perl (and 
here we give a perl error). So I suggest:

              modperl_log_warn(s, apr_psprintf(p, "%s at %s line %d",
                                               SvPVX(ERRSV),
                                               directive->filename,
                                               directive->line_num));

but may be it's totally irrelevant if we drop that feature completely.

-- 
__________________________________________________________________
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: [mp2 Patch] Make sections strict by default

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Philippe M. Chiasson wrote:
> As has been requested for quite a while, this patch _finally_ makes
> <Perl> sections
> strict by default.

cool, looks good to me.

--Geoff

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