mod_perl syntax isn't different from perl. It is just a module as far as the perl side (it interacts with the Apache side, which is why apache needs to be patched, but the perl works the same)

_writing_ scripts with mod_perl is fairly significantly different. You can write stuff using Apache::Registry, but that's really a stopgap measure.

mod_perl allows you to write handlers for requests to apache. "Normally", with a cgi script, the request comes in, apache looks at it and does all the various lookups to get the right file. It then says "Ah, this is a CGI request", and hands it to the CGI handler. This, in turn, reads in the file, executes the she-bang line, and your script runs just as if it had been run from the command line. Output is then handed back to Apache, which passes it to the browser, and the user sees the results.

mod_perl lets you write your own handlers for requests. This is vastly faster, since you don't have to load Perl (it's resident), and perl has already pre-interpreted what it can of the script. It does represent a difference in how you think of requests. Your variables aren't limited to one execution, for example.

mod_perl is cool. The various mod_perl sites tend to assume you know what's going on, so I highly recommend the Eagle book from O'Reilly.

(The above is my simplified and possibly wrong interpretation of how mod_perl and Apache work their magic)


In reply to Re: Re: mod_perl installation weirdo... by swiftone
in thread mod_perl installation weirdo... by ismail

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.