Dear Monks:

Under FastCGI processes, is there a good way to update a preloaded Perl Module just like Apache::Reload for mod_perl users. I am currently using kill -9 to restart the fcgi process, so each time I get some changes on my modules, I have to restart(kill) fcgi process to update these changes.. Is there any better way to do this?? I am using Apache2.0.59, mod_fastcgi/2.4.2, CGI::Fast with HTML::Mason.

A couple of days ago, I asked this question in FCGI's mailing group, some suggestions include:

  1. Add code that checks module timestamps when you get a call and does a do on the changed files before processing.
  2. Add a signal handler that processes the files when it is received

For suggestion-(1), I think I can do things like

if ( -M "/path/to/lib/MyModule.pm" < 0 ) { require MyModule; MyModule->import(qw[ :mytag ]); }

But my questions keep:

  1. the '-M' test looks expensive if I put it in the FCGI loop and do it on every request
  2. what are the differences between 'require' and the suggested "do" here?, given that I do need to import some functions from that modules
  3. What should be considered differently between an OO-modules and non-OO-modules in this context..

For the suggestion-(2), I am not sure which SIG should I trap to handle the file change

Thanks for your further advices..

Best regrads,

Lihao(XC)


In reply to FastCGI and mod_perl's Apache::Reload equivalent??? by lihao

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.