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/08/16 23:13:03 UTC

[Patch mp2] Apache::MethodList

In trying to make sense of Apache::CmdParms->limited() I realized it was
mainly useless to expose, and that there was a method ap_method_is_limited()
designed for that exact purpose.

So the following patch removed the parms->limited field and replaces it
with ap_method_is_limited(). For consistency, I suggest making the
Apache::MethodList class available.

Thoughts ?

Stas Bekman wrote:
> gozer@apache.org wrote:
> 
>>gozer       2004/08/12 22:45:50
>>
>>  Modified:    src/docs/2.0/api/Apache CmdParms.pod Command.pod
>>  Log:
>>  Apache::CmdParms is completed.
>>  Awaiting review by Stas please...
> 
> 
> I've committed some tweaks, including a missing argument check_cmd_context 
> and some examples without which users won't know what to do with the 
> methods. But please review my examples/notes.
> 
> there is one more things to do is to complete the entry:
> 
> =head2 C<limited>
> 
> the META tag in the body.
> 

-- 
--------------------------------------------------------------------------------
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] Apache::MethodList

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

Philippe M. Chiasson wrote:
> In trying to make sense of Apache::CmdParms->limited() I realized it was
> mainly useless to expose, and that there was a method
> ap_method_is_limited()
> designed for that exact purpose.
> 
> So the following patch removed the parms->limited field and replaces it
> with ap_method_is_limited(). For consistency, I suggest making the
> Apache::MethodList class available.
> 
> Thoughts ?

at only a glance, it looks good to me.

--Geoff

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


Re: [Patch mp2] Apache::MethodList

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

Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
> 
>>For nothing, really. I must apologize for the confusion. I started
>>trying to get ->limited to work, and for that, I needed to open
>>up Apache::MethodList.
> 
> 
> :)
> 
> 
>>I abandonned that effort too late for a simpler implementation of
>>ap_method_is_limited().
>>
>>Attached are the 2 patches, separated. (The second one possibly
>>usefull in the future if/when we decide we need Apache::MethodList)
> 
> 
> +1 for the first one.

On it's way.

> As for Apache::MethodList I don't want your efforts to go wasted, but on 
> the other hand I can't see where it may come in handy. And if you commit 
> it, you need to write a manpage for it :) So it's up to you, if you feel 
> like writing a manpage for it, go with it, if not just add a note 
> somewhere in todo/features_maybe and add a url of the patch from marc.'s 
> mail archive.
> http://marc.theaimsgroup.com/?l=apache-modperl-dev

I did write the tests for it, but I agree with you. There are only 2-3 fields
I saw that were method_lists and I can't think of a reason why it would be usefull
for now. So in the archives it goes.

-- 
--------------------------------------------------------------------------------
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] Apache::MethodList

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:

> For nothing, really. I must apologize for the confusion. I started
> trying to get ->limited to work, and for that, I needed to open
> up Apache::MethodList.

:)

> I abandonned that effort too late for a simpler implementation of
> ap_method_is_limited().
> 
> Attached are the 2 patches, separated. (The second one possibly
> usefull in the future if/when we decide we need Apache::MethodList)

+1 for the first one.

As for Apache::MethodList I don't want your efforts to go wasted, but on 
the other hand I can't see where it may come in handy. And if you commit 
it, you need to write a manpage for it :) So it's up to you, if you feel 
like writing a manpage for it, go with it, if not just add a note 
somewhere in todo/features_maybe and add a url of the patch from marc.'s 
mail archive.
http://marc.theaimsgroup.com/?l=apache-modperl-dev

-- 
__________________________________________________________________
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] Apache::MethodList

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

Stas Bekman wrote:
> Philippe M. Chiasson wrote:
> 
>>In trying to make sense of Apache::CmdParms->limited() I realized it was
>>mainly useless to expose, and that there was a method 
>>ap_method_is_limited()
>>designed for that exact purpose.
>>
>>So the following patch removed the parms->limited field and replaces it
>>with ap_method_is_limited(). 
> 
> 
> +1
> 
> 
>>For consistency, I suggest making the
>>Apache::MethodList class available.
> 
> 
> For consistency with what? What do we need this class for?

For nothing, really. I must apologize for the confusion. I started
trying to get ->limited to work, and for that, I needed to open
up Apache::MethodList.

I abandonned that effort too late for a simpler implementation of
ap_method_is_limited().

Attached are the 2 patches, separated. (The second one possibly
usefull in the future if/when we decide we need Apache::MethodList)

> 
>>Thoughts ?
>>
>>Index: docs/api/Apache/CmdParms.pod
>>===================================================================
> 
> 
>>       # which methods are <Limit>ed ?
>>-      $limit = $parms->limited;
>>+      $limit = $parms->method_is_limited('GET');
> 
> 
> here and below, a more suitable return var name should be used, e.g. 
> is_limited
> 
> 
>>-  $limit = $parms->limited;
>>+  $limit = $parms->method_is_limited($method);
> 
> 
>>+=item ret: C<$limit> ( boolean )
> 
> 

-- 
--------------------------------------------------------------------------------
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] Apache::MethodList

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> In trying to make sense of Apache::CmdParms->limited() I realized it was
> mainly useless to expose, and that there was a method 
> ap_method_is_limited()
> designed for that exact purpose.
>
> So the following patch removed the parms->limited field and replaces it
> with ap_method_is_limited(). 

+1

> For consistency, I suggest making the
> Apache::MethodList class available.

For consistency with what? What do we need this class for?

> Thoughts ?
> 
> Index: docs/api/Apache/CmdParms.pod
> ===================================================================

>        # which methods are <Limit>ed ?
> -      $limit = $parms->limited;
> +      $limit = $parms->method_is_limited('GET');

here and below, a more suitable return var name should be used, e.g. 
is_limited

> -  $limit = $parms->limited;
> +  $limit = $parms->method_is_limited($method);

> +=item ret: C<$limit> ( boolean )

-- 
__________________________________________________________________
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] Apache::MethodList

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> 
> 
> Stas Bekman wrote:
> 
>> Philippe M. Chiasson wrote:
>> [...]
>>
>>> +For example, to check if the C<GET> method is being E<lt>LimitE<gt>ed
>>> +in the current scope, do:
>>> +
>>> +  if ($parms->method_is_limited('GET') {
>>> +      die "...";
>>> +  }
>>
>>
>>
>> For code sections in the docs please always use a prefix of two 
>> spaces. So it's easy to move code from docs to real modules for 
>> testing with:
>>
>>    perl -pi -e 's|^  ||'  file
>>
> 
> What do you mean, I thought that -was- 2 spaces.

I'm filing a glasses prescription at this very moment. Sorry :(

-- 
__________________________________________________________________
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] Apache::MethodList

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
[...]
> +For example, to check if the C<GET> method is being E<lt>LimitE<gt>ed
> +in the current scope, do:
> +
> +  if ($parms->method_is_limited('GET') {
> +      die "...";
> +  }

For code sections in the docs please always use a prefix of two spaces. So 
it's easy to move code from docs to real modules for testing with:

   perl -pi -e 's|^  ||'  file


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