This was only intended as an example, not a fully tested solution. What I know about writing HTTP servers is entirely captured in that post.

It took all of 1/2 an hour to get it to the stage it is at now. It would have taken 10 minutes had my browser not been caching unexpired pages for at least 5 hours--which appears to be fixed by the addition of an "Expires" header.

The XP issue is down to the -slw on the shebang line--now removed. The beneficial side-effect is that is removes the need for send_crlf, which I didn't think I should need, but it was late (or rather early).

Ie. my fault. Updated. I'd appreciate someone with a threaded perl on OSX and Linux giving the modified version a spin in a few minutes.

It obviously won't run without threads installed.

POE may be easier to install. Maybe, if you have a lot of other packages already installed. I can sympathise with the Perl Upgrade problem.

And if your application lends itself to be broken up into a state machine, then your laughing.

The nice thing about the webserver in a thread, is that it would require no change to your existing application except a couple of : shared attributes.

And maybe a few locks , but you can get away without those unless it is really important that all the values in displayed on your status page are exactly synchronised.

Thanks for the feedback and good luck with your code.


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

In reply to Re^3: Embedding a web-server in a long-running process? by BrowserUk
in thread Embedding a web-server in a long-running process? by howie

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.