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 2005/01/10 21:44:09 UTC

[Patch mp2] Case-insensitive PerlOptions

Currently, PerlOptions takes case-sensitive options, (e.g. RegisterGlobal)
and any change in capitalization will not be recognized as a valid option.

Suggested patch makes it case-insensitive.

Index: lib/ModPerl/Code.pm
===================================================================
--- lib/ModPerl/Code.pm	(revision 124830)
+++ lib/ModPerl/Code.pm	(working copy)
@@ -451,7 +451,7 @@
                  if (/^(\w)/) {
                      my $gap = " " x ($max_len - length $_);
                      push @{ $switch{$1} },
-                        qq{if (strEQ(str, "$_"))$gap return $lookup{$_};};
+                        qq{if (0==strcasecmp(str, "$_"))$gap return $lookup{$_};};
                  }
              }


--------------------------------------------------------------------------------
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: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
> 
> 
>>Joe Schaefer wrote:
>>
>>>Stas Bekman <st...@stason.org> writes:
>>>
>>>
>>>>Philippe M. Chiasson wrote:
>>>
>>>[...]
>>>
>>>
>>>>>So, even thought we started talking about specifically PerlOptions, I
>>>>>wanted to get a good idea of how people felt about the rest of our
>>>>>configuration directives. Makes sense?
>>>>
>>>>Yup.
>>>
>>>+1 to case-insensitivity across the board on our httpd.conf options.
>>>I'm sure most users will like it that way, and they can well afford
>>>the tiny CPU cost involved.  Those that can't afford it should not be
>>>using .htaccess files in the first place.
>>
>>I wasn't talking about .htaccess, but real APIs like
>>modperl_config_is_perl_option_enabled(), which are affected.
> 
> 
> Oh I see that now.  Even for that, if needed we could optimize 
> the modperl_flags_lookup_* code and do away with all the strcmp 
> checks.  So I stand by my +1.

Optimise by providing another autogenerated version of lookup functions? I 
guess that can work.

It will also be inconsistent with case-insensitive functionality in the 
config files.

-- 
__________________________________________________________________
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: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:

> Joe Schaefer wrote:
>> Stas Bekman <st...@stason.org> writes:
>>
>>>Philippe M. Chiasson wrote:
>> [...]
>>
>>>>So, even thought we started talking about specifically PerlOptions, I
>>>>wanted to get a good idea of how people felt about the rest of our
>>>> configuration directives. Makes sense?
>>>
>>>Yup.
>> +1 to case-insensitivity across the board on our httpd.conf options.
>> I'm sure most users will like it that way, and they can well afford
>> the tiny CPU cost involved.  Those that can't afford it should not be
>> using .htaccess files in the first place.
>
> I wasn't talking about .htaccess, but real APIs like
> modperl_config_is_perl_option_enabled(), which are affected.

Oh I see that now.  Even for that, if needed we could optimize 
the modperl_flags_lookup_* code and do away with all the strcmp 
checks.  So I stand by my +1.

-- 
Joe Schaefer


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


Re: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
> 
> 
>>Philippe M. Chiasson wrote:
> 
> 
> [...]
> 
> 
>>>So, even thought we started talking about specifically PerlOptions, I
>>>wanted to get a good idea of how people felt about the rest of our
>>>configuration directives. 
>>>Makes sense?
>>
>>Yup.
> 
> 
> +1 to case-insensitivity across the board on our httpd.conf options.
> I'm sure most users will like it that way, and they can well afford 
> the tiny CPU cost involved.  Those that can't afford it should not be 
> using .htaccess files in the first place.

I wasn't talking about .htaccess, but real APIs like 
modperl_config_is_perl_option_enabled(), which are affected.


-- 
__________________________________________________________________
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: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:

> Philippe M. Chiasson wrote:

[...]

>> So, even thought we started talking about specifically PerlOptions, I
>> wanted to get a good idea of how people felt about the rest of our
>> configuration directives. 
>> Makes sense?
>
> Yup.

+1 to case-insensitivity across the board on our httpd.conf options.
I'm sure most users will like it that way, and they can well afford 
the tiny CPU cost involved.  Those that can't afford it should not be 
using .htaccess files in the first place.

-- 
Joe Schaefer


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


Re: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Stas Bekman wrote:
> 
>> Philippe M. Chiasson wrote:
>>
>>> [...]
>>>
>>> So, can I have a clear vote on these 2 issues:
>>>
>>> 1. Consider all our configuration directives for case-insensitivity
>>> 2. Make PerlOptions case-insensitive
>>
>>
>> I believe your vote proposal doesn't state the arguments correcly. I 
>> believe it should mention:
>>
>>    "while somewhat slowing down some APIs"
> 
> 
> I certainly should have mentionned that..

In fact make it: "while somewhat slowing down some non-startup APIs"

>> e.g. I'd +1 to consider the case-insentivity in general, but -0 if it 
>> slows things down.
> 
> 
> Well, I don't think there is any way to have case-insensitivity in general
> without a speed penalty wrt. case-sensitiveness.
> 
>> also why those are 2 issues, and not one?
> 
> 
> Well, I wanted to raise a more general issue of case-sensitivity in 
> config files.
> I believe that having some directive case-sensitive, and other 
> case-insensitive would
> be a _bad_ (certainly confusing thing).
> 
> So, even thought we started talking about specifically PerlOptions, I 
> wanted to get a good
> idea of how people felt about the rest of our configuration directives.
> 
> Makes sense?

Yup.

I'm +1 to any extra startup overheads for a good cause, but -0 for any 
run-time overheads if those can be avoided.


-- 
__________________________________________________________________
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: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>> [...]
>>
>>So, can I have a clear vote on these 2 issues:
>>
>>1. Consider all our configuration directives for case-insensitivity
>>2. Make PerlOptions case-insensitive
> 
> I believe your vote proposal doesn't state the arguments correcly. I 
> believe it should mention:
> 
>    "while somewhat slowing down some APIs"

I certainly should have mentionned that..

> e.g. I'd +1 to consider the case-insentivity in general, but -0 if it 
> slows things down.

Well, I don't think there is any way to have case-insensitivity in general
without a speed penalty wrt. case-sensitiveness.

> also why those are 2 issues, and not one?

Well, I wanted to raise a more general issue of case-sensitivity in config files.
I believe that having some directive case-sensitive, and other case-insensitive would
be a _bad_ (certainly confusing thing).

So, even thought we started talking about specifically PerlOptions, I wanted to get a good
idea of how people felt about the rest of our configuration directives.

Makes sense?
--------------------------------------------------------------------------------
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: [vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> This discussion seems to have dwindled, and I don't have a clear idea if 
> we all
> think moving towards case-insensitivity for our configuration directives 
> is a good
> idea or not.
> 
> So, can I have a clear vote on these 2 issues:
> 
> 1. Consider all our configuration directives for case-insensitivity
> 2. Make PerlOptions case-insensitive

I believe your vote proposal doesn't state the arguments correcly. I 
believe it should mention:

   "while somewhat slowing down some APIs"

e.g. I'd +1 to consider the case-insentivity in general, but -0 if it 
slows things down.

also why those are 2 issues, and not one?

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


[vote] Re: [Patch mp2] Case-insensitive PerlOptions

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
This discussion seems to have dwindled, and I don't have a clear idea if we all
think moving towards case-insensitivity for our configuration directives is a good
idea or not.

So, can I have a clear vote on these 2 issues:

1. Consider all our configuration directives for case-insensitivity
2. Make PerlOptions case-insensitive

--------------------------------------------------------------------------------
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] Case-insensitive PerlOptions

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 10 Jan 2005, Joe Schaefer wrote:

> "Philippe M. Chiasson" <go...@ectoplasm.org> writes:
>
> > Currently, PerlOptions takes case-sensitive options, (e.g. RegisterGlobal)
> > and any change in capitalization will not be recognized as a valid option.
> >
> > Suggested patch makes it case-insensitive.
>
> +1 to case-insensitive options.

+1

-- 
best regards,
randy

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


Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Philippe M. Chiasson" <go...@ectoplasm.org> writes:

> Currently, PerlOptions takes case-sensitive options, (e.g. RegisterGlobal)
> and any change in capitalization will not be recognized as a valid option.
>
> Suggested patch makes it case-insensitive.

+1 to case-insensitive options.

-- 
Joe Schaefer


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


Re: [Patch mp2] Case-insensitive PerlOptions

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

Joe Schaefer wrote:
> I really
> see this as reducing user complaints; after all, httpd's 
> "Options" are case-insensitive as well.

I'm tempted to agree with this pov.

if performance is really an issue, we could just make case-sensitivity a
compile time option, enabling case-insensitive directives as a default.  but
it sure seems like overkill here.

--Geoff

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


Re: [Patch mp2] Case-insensitive PerlOptions

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
> 
> [...]
> 
>>-0:
>>
>>while it's fine for startup code, it'll affect
>>modperl_config_is_perl_option_enabled, that may be called at request
>>time == slowdown. 
> 
> Are the option strings in German or something?  It can't
> be a measurable performance difference to downcase a dozen 
> or so chars, can it?

My simple benchmark with strcmp vs. strcasecmp show strcasecmp() to be
around 10% slower:

3073412300/s => strcasecmp()
3485295200/s => strcmp()

Overall, the slowdown is about .0000000000384 sec per call (avg).

>>And that change may affect other things added in the future.
> 
> Hopefully they don't depend on the case then.  I really
> see this as reducing user complaints; after all, httpd's 
> "Options" are case-insensitive as well.

This patch came to be after trying to have the HTTPExpose option.
I, personally, almost always make the assumption that httpd.conf
directives are case-insensitive.

--------------------------------------------------------------------------------
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] Case-insensitive PerlOptions

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:


[...]

> -0:
>
> while it's fine for startup code, it'll affect
> modperl_config_is_perl_option_enabled, that may be called at request
> time == slowdown. 

Are the option strings in German or something?  It can't
be a measurable performance difference to downcase a dozen 
or so chars, can it?

> And that change may affect other things added in the future.

Hopefully they don't depend on the case then.  I really
see this as reducing user complaints; after all, httpd's 
"Options" are case-insensitive as well.

-- 
Joe Schaefer


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


Re: [Patch mp2] Case-insensitive PerlOptions

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Currently, PerlOptions takes case-sensitive options, (e.g. RegisterGlobal)
> and any change in capitalization will not be recognized as a valid option.
> 
> Suggested patch makes it case-insensitive.
> 
> Index: lib/ModPerl/Code.pm
> ===================================================================
> --- lib/ModPerl/Code.pm    (revision 124830)
> +++ lib/ModPerl/Code.pm    (working copy)
> @@ -451,7 +451,7 @@
>                  if (/^(\w)/) {
>                      my $gap = " " x ($max_len - length $_);
>                      push @{ $switch{$1} },
> -                        qq{if (strEQ(str, "$_"))$gap return $lookup{$_};};
> +                        qq{if (0==strcasecmp(str, "$_"))$gap return 
> $lookup{$_};};
>                  }
>              }

-0:

while it's fine for startup code, it'll affect 
modperl_config_is_perl_option_enabled, that may be called at request time 
== slowdown. And that change may affect other things added in the future. 
I see nothing wrong with having the options case-sensitive.

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