You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/07/14 16:03:51 UTC

Re: module ported and doc addition...

Shannon Eric Peevey wrote:
> Shannon Eric Peevey wrote:
> 
>> Hi!
>>
>> Just wanted to let everyone know that I have just finished porting the 
>> Apache-AuthExpire module to work with both modperl1 and 2.  It is a: 
>> #               Small mod_perl handler to provide Authentication phase 
>> time outs for
>> #               sensitive areas, per realm.
>> There are some issues with konqueror, mozilla and netscape, but should 
>> be a simple fix if someone is watching the headers....

Great, I've updated the online list of ported modules.

>> Possible documentation inclusion...?:  When using a ternary 
>> conditional in conjunction with a conditional operator, I needed to 
>> enclose the statement with parentheses to force the ternary 
>> conditional to be executed first.  For example:
>>
>>    my ($res, $sent_pw) = $r->get_basic_auth_pw;
>>    return $res if $res !=  (MP2 ? Apache::OK : 
>> Apache::Constants::OK);  # return not OK status if not OK

well, this is not a mod_perl issue. '=~' has a higher precedence than '?:'
http://www.perldoc.com/perl5.8.0/pod/perlop.html#SYNOPSIS

Also, you don't realy have to do that. The old ala mp1 style works just fine.

use Apache::Const qw(OK DECLINED)

sub handler {

    return OK;
}

>> Took me a while to catch that... :P
>>
>> speeves
>> cws
>>
> Is J. J. Horner on this list?  (Are you out there...? :)) ) 
> If so, can you contact me about getting permissions to upload the 
> Apache-AuthExpire mod that I have ported?  (So it can be indexed by PAUSE.)
> 
> Also, Stas, is there a way that I can get around having to wait for an 
> author to upload a ported module?  I am not adding any functionality 
> except making it work with both versions of modperl, and making 
> additions that the CPAN testers have requested.  I have a clear window 
> for now, and would like to keep on porting mods while I have a little 
> extra time...

You can always upload a module, however it won't be indexed and then it's 
going to be a pain to reindex, since you will have to ask Andreas to do that. 
So I'd get the permissions resolved first. If you can't reach the original 
author you should email modules@perl.org explaining the situation and asking 
to give you the right perms (nowadays CPAN supports co-owners of namespaces).

Meanwhile upload it somewhere online and post the link here, I'll link to it 
from:  /http://perl.apache.org/products/apache-modules.html

__________________________________________________________________
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


Re: module ported and doc addition...

Posted by Shannon Eric Peevey <sp...@unt.edu>.
Stas Bekman wrote:

> Shannon Eric Peevey wrote:
> [...]
>
>>> Also, you don't realy have to do that. The old ala mp1 style works 
>>> just fine.
>>>
>>> use Apache::Const qw(OK DECLINED)
>>>
>>> sub handler {
>>>
>>>    return OK;
>>> } 
>>
>>
>>
>> Well...  I must have been smoking crack, 'cause I seem to remember a 
>> simple:
>>
>> return  MP2 ? Apache::OK : OK
>>
>> throwing an error, hence, the change to:
>>
>> MP2 ? Apache::OK : Apache::Constants::OK
>>
>> Now that I test it, though, there doesn't seem to be a problem...  :P
>
>
> May be you haven't been importing the constant. These two aren't the 
> same:
>
> use Apache::Const qw(OK DECLINED);
> use Apache::Const -compile => qw(OK DECLINED);
>
> the latter only compiles the constants, the former compiles and 
> imports it.
>
> [...] 

Here is the code:

BEGIN {
        if (MP2) {
                require Apache::Const;
                require Apache::Access;
                require Apache::Connection;
                require Apache::Log;
                require Apache::RequestRec;
                require Apache::RequestUtil;
                Apache::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK');
        } else {
                require Apache::Constants;
                Apache::Constants->import('HTTP_UNAUTHORIZED','OK');
        }
}

(Or, variations upon it...)  As I've said, though, my code is dying with 
an error on Apache::Constants anymore....  If I hit it again, I will 
post the error message that I was getting.

thanks,
speeves
cws


Re: module ported and doc addition...

Posted by Stas Bekman <st...@stason.org>.
Shannon Eric Peevey wrote:
> Stas Bekman wrote:
> 
>> Shannon Eric Peevey wrote:
>> [...]
>>
>>>> Also, you don't realy have to do that. The old ala mp1 style works 
>>>> just fine.
>>>>
>>>> use Apache::Const qw(OK DECLINED)
>>>>
>>>> sub handler {
>>>>
>>>>    return OK;
>>>> } 
>>>
>>>
>>>
>>>
>>> Well...  I must have been smoking crack, 'cause I seem to remember a 
>>> simple:
>>>
>>> return  MP2 ? Apache::OK : OK
>>>
>>> throwing an error, hence, the change to:
>>>
>>> MP2 ? Apache::OK : Apache::Constants::OK
>>>
>>> Now that I test it, though, there doesn't seem to be a problem...  :P
>>
>>
>>
>> May be you haven't been importing the constant. These two aren't the 
>> same:
>>
>> use Apache::Const qw(OK DECLINED);
>> use Apache::Const -compile => qw(OK DECLINED);
>>
>> the latter only compiles the constants, the former compiles and 
>> imports it.
>>
>> [...]
>>
> Just started working on Apache-AuthNTLM and came across the cross 
> reference that you posted awhile back.  This might be where I got it:
> 
>  sub handler {
>      # ...
>      return MP2 ? Apache::OK : Apache::Constants::OK;
>  }
>  1;
> 
> in the "mod_perl 1.0 and 2.0 Constants Coexistence" section of:
> 
> http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Constants_ 

Yup, in mod_perl 2.0 we should better use fully qualified constants, because 
now we have APR:: and Apache:: constants, hence the docs use this style 
everywhere. However the mp1's style works as well. Though I haven't checked 
whether there are any overlaps if the top level is removed.



__________________________________________________________________
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



Re: module ported and doc addition...

Posted by Shannon Eric Peevey <sp...@unt.edu>.
Stas Bekman wrote:

> Shannon Eric Peevey wrote:
> [...]
>
>>> Also, you don't realy have to do that. The old ala mp1 style works 
>>> just fine.
>>>
>>> use Apache::Const qw(OK DECLINED)
>>>
>>> sub handler {
>>>
>>>    return OK;
>>> } 
>>
>>
>>
>> Well...  I must have been smoking crack, 'cause I seem to remember a 
>> simple:
>>
>> return  MP2 ? Apache::OK : OK
>>
>> throwing an error, hence, the change to:
>>
>> MP2 ? Apache::OK : Apache::Constants::OK
>>
>> Now that I test it, though, there doesn't seem to be a problem...  :P
>
>
> May be you haven't been importing the constant. These two aren't the 
> same:
>
> use Apache::Const qw(OK DECLINED);
> use Apache::Const -compile => qw(OK DECLINED);
>
> the latter only compiles the constants, the former compiles and 
> imports it.
>
> [...]
>
Just started working on Apache-AuthNTLM and came across the cross 
reference that you posted awhile back.  This might be where I got it:

  sub handler {
      # ...
      return MP2 ? Apache::OK : Apache::Constants::OK;
  }
  1;

in the "mod_perl 1.0 and 2.0 Constants Coexistence" section of:

http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Constants_

speeves
cws


Re: module ported and doc addition...

Posted by Stas Bekman <st...@stason.org>.
Shannon Eric Peevey wrote:
[...]
>> Also, you don't realy have to do that. The old ala mp1 style works 
>> just fine.
>>
>> use Apache::Const qw(OK DECLINED)
>>
>> sub handler {
>>
>>    return OK;
>> } 
> 
> 
> Well...  I must have been smoking crack, 'cause I seem to remember a 
> simple:
> 
> return  MP2 ? Apache::OK : OK
> 
> throwing an error, hence, the change to:
> 
> MP2 ? Apache::OK : Apache::Constants::OK
> 
> Now that I test it, though, there doesn't seem to be a problem...  :P

May be you haven't been importing the constant. These two aren't the same:

use Apache::Const qw(OK DECLINED);
use Apache::Const -compile => qw(OK DECLINED);

the latter only compiles the constants, the former compiles and imports it.

[...]

> Thanks.  I have received that permission from Mr. Horner since I have 
> written this email.  I have contacted the modules@perl.org gang, but 
> they haven't responded yet.  (No problems, as I am about to start on 
> Apache-AuthNTLM.)  I will upload another version to CPAN when they give 
> me authorization. :)
> 
> Also, I have ported:
> 
> Apache-AuthenPasswd
> Apache-AuthzPasswd

I've updated the online list.

> with notices as to the limitations of these modules.  (I inherited these 
> with the AuthenNIS mods...  Haven't had a chance to port those yet, 
> though.)  They have been uploaded and indexed on CPAN.

Since you now have the perms, you no longer need to get the blessing from the 
modules list. Simply go ahead and upload your module. First go to the PAUSE 
interface and check that you actually co-own the modules in question.

> Also need to get excited about getting the authperlldap mod done as 
> well... :)

;)


__________________________________________________________________
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


Re: module ported and doc addition...

Posted by Shannon Eric Peevey <sp...@unt.edu>.
Stas Bekman wrote:

> Shannon Eric Peevey wrote:
>
>> Shannon Eric Peevey wrote:
>>
>>> Hi!
>>>
>>> Just wanted to let everyone know that I have just finished porting 
>>> the Apache-AuthExpire module to work with both modperl1 and 2.  It 
>>> is a: #               Small mod_perl handler to provide 
>>> Authentication phase time outs for
>>> #               sensitive areas, per realm.
>>> There are some issues with konqueror, mozilla and netscape, but 
>>> should be a simple fix if someone is watching the headers....
>>
>
> Great, I've updated the online list of ported modules.

Thanks :)

>
>>> Possible documentation inclusion...?:  When using a ternary 
>>> conditional in conjunction with a conditional operator, I needed to 
>>> enclose the statement with parentheses to force the ternary 
>>> conditional to be executed first.  For example:
>>>
>>>    my ($res, $sent_pw) = $r->get_basic_auth_pw;
>>>    return $res if $res !=  (MP2 ? Apache::OK : 
>>> Apache::Constants::OK);  # return not OK status if not OK
>>
>
> well, this is not a mod_perl issue. '=~' has a higher precedence than 
> '?:'
> http://www.perldoc.com/perl5.8.0/pod/perlop.html#SYNOPSIS
>
> Also, you don't realy have to do that. The old ala mp1 style works 
> just fine.
>
> use Apache::Const qw(OK DECLINED)
>
> sub handler {
>
>    return OK;
> } 

Well...  I must have been smoking crack, 'cause I seem to remember a simple:

return  MP2 ? Apache::OK : OK

throwing an error, hence, the change to:

 MP2 ? Apache::OK : Apache::Constants::OK

Now that I test it, though, there doesn't seem to be a problem...  :P

>
>
>>> Took me a while to catch that... :P
>>>
>>> speeves
>>> cws
>>>
>> Is J. J. Horner on this list?  (Are you out there...? :)) ) If so, 
>> can you contact me about getting permissions to upload the 
>> Apache-AuthExpire mod that I have ported?  (So it can be indexed by 
>> PAUSE.)
>>
>> Also, Stas, is there a way that I can get around having to wait for 
>> an author to upload a ported module?  I am not adding any 
>> functionality except making it work with both versions of modperl, 
>> and making additions that the CPAN testers have requested.  I have a 
>> clear window for now, and would like to keep on porting mods while I 
>> have a little extra time...
>
>
> You can always upload a module, however it won't be indexed and then 
> it's going to be a pain to reindex, since you will have to ask Andreas 
> to do that. So I'd get the permissions resolved first. If you can't 
> reach the original author you should email modules@perl.org explaining 
> the situation and asking to give you the right perms (nowadays CPAN 
> supports co-owners of namespaces).
>
> Meanwhile upload it somewhere online and post the link here, I'll link 
> to it from:  /http://perl.apache.org/products/apache-modules.html 

Thanks.  I have received that permission from Mr. Horner since I have 
written this email.  I have contacted the modules@perl.org gang, but 
they haven't responded yet.  (No problems, as I am about to start on 
Apache-AuthNTLM.)  I will upload another version to CPAN when they give 
me authorization. :)

Also, I have ported:

Apache-AuthenPasswd
Apache-AuthzPasswd

with notices as to the limitations of these modules.  (I inherited these 
with the AuthenNIS mods...  Haven't had a chance to port those yet, 
though.)  They have been uploaded and indexed on CPAN.

Also need to get excited about getting the authperlldap mod done as 
well... :)

thanks,
speeves
cws