It took me a while to get my head around EmbPerl. Instead of what I consider a normal path -- HTTP request from client comes to Apache, that request is passed to a page which in turn calls a Perl Module to actually output stuff, Apache passes the request to the EmbPerl page which in turn calls the Perl Module -- which cooks up a bunch of data then passes it back to the EmbPerl page, which then formats it nicely.

It's a bit like programming a TSR (boy am I dating myself now) where as soon as you start, the two things you have to check for are "Am I already running?" and "Am I trying to unload myself?" Sort of a doublethink approach to how your program behaves. (If both statements are true, then you have to unload the original copy, then exit, rather than doing the installation thing .. but that's not important right now.)

You can do as much Perl in an EmbPerl environment as you like, but it's recommended that the heavy crunching be done in a Perl Module, with just light work done in the EmbPerl file.

I can also recommend this documentation .. very handy.

--t. alex

"Excellent. Release the hounds." -- Monty Burns.


In reply to Re: embperl by talexb
in thread embperl tips? by tstock

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.