Mailing List Archive

mod_perl , ChildInitHandler, OpenApi
Hi,

we're running our application build with mod_perl and MasonX::WebApp::ApacheHandler (quite old, yes I know)
Now I would like to use OpenAPI::Client to connect to some other web services we need. OpenAPI::Client generates code based on the api specification, but this takes 3 -4 seconds , which is far too slow to call it on every request.
How can I initialize the OpenAPI::Client during server startup and use the compiled code later ( i.e. access the object created)? I'm thinking about doing this in a ChildInitHandler, but I have no idea, where to "store" the result. We're using mom_event in production, anything to consider with this ?

Thanks
Rolf
Re: mod_perl , ChildInitHandler, OpenApi [ In reply to ]
You can use the $r->pnotes to pass blessed Perl objects between
handlers that run at different phases:

Apache2::RequestUtil -- $r->pnotes
https://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_pnotes_

(I'm assuming that you're using mod_perl2.)

> Hi,
>
> we're running our application build with mod_perl and MasonX::WebApp::ApacheHandler (quite old, yes I know)
> Now I would like to use OpenAPI::Client to connect to some other web services we need. OpenAPI::Client generates code based on the api specification, but this takes 3 -4 seconds , which is far too slow to call it on every request.
> How can I initialize the OpenAPI::Client during server startup and use the compiled code later ( i.e. access the object created)? I'm thinking about doing this in a ChildInitHandler, but I have no idea, where to "store" the result. We're using mom_event in production, anything to consider with this ?
>
> Thanks
> Rolf
>


Randolf Richardson - randolf@inter-corporate.com
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
https://www.inter-corporate.com/