perl module for nginx

David Coutadeur dcoutadeur at linagora.com
Wed May 14 17:06:39 UTC 2014


Le 14/05/2014 18:58, Maxim Dounin a écrit :
> Hello!
>
> On Wed, May 14, 2014 at 06:47:26PM +0200, David Coutadeur wrote:
>
>>
>> Hello,
>>
>> I am trying to build a perl access handler module into nginx, thanks to this
>> API :
>> http://nginx.org/en/docs/http/ngx_http_perl_module.html
>> but I have some difficulties to do so.
>>
>> Indeed, I would need some tools like
>> - a mean to share variables between handlers,
>> - a mean to call my handler at access phase.
>>
>> For example, I have made a basic handler in lUA with this more complete API
>> :
>> http://wiki.nginx.org/HttpLuaModule
>>
>> Does anybody have ideas on how to achieve the two functionnalities in the
>> current perl API ?
>> Will this lack of features for perl API be filled in the future ? In a near
>> future ? Or do you advise other actions ?
>
> Sharing variables (I believe you really want to do so between
> requests) can be done using normal Perl things like global
> variables (or, if you want many workers to share the same data,
> using shared memory, see various perl modules available on CPAN).

Yes, this is what I want to do. For example, loading some parameters 
from a config file, and store them in a shared memory place. Do you have 
some advice on a CPAN module which works best with nginx ?

>
> Calling the handler at access phase isn't something you can do
> without modifications of the code.  On the other hand, it may be a
> good idea to use auth request module[1] instead, and write a
> subrequest handler in embedded perl.
>
> [1] http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
>

Ok, thank you, I will try this !

David



More information about the nginx mailing list