In the bad old days, Perl-based CGIs were started by spawning a new interpreter for each request. As you might imagine, this was very expensive and not very scalable. You could be parsing a multi-megabyte flat-file, but start up time would still be the limiting factor for speed. These days, you can use mod_perl to embed the interpreter right into Apache (there are similar solutions for other web servers). Though there are places with a lot of legacy scripts (like where I work) that simply can't run under mod_perl.

As far as the embedded interpeter goes, mod_perl and mod_php do the same thing for their respective language (mod_perl also gives you access to the underlieing Apache API--I'm not sure if mod_php does this). PHP as a language is basically Perl with all the fun parts taken out. Some would argue that the "fun parts" make Perl hard to learn. Even so, whenever I dabble in PHP, I always seem to knock against a problem that is easily solved in Perl, but takes a lot of hoop-jumping to do in PHP, despite the apparent similarities. Admittedly, this may have more to do with my relative experiance with Perl and PHP.

Don't make the mistake of saying CGI == Perl. CGI is just a standard for how http servers translate data coming from an http client to a user-space program. Any time you see a server-side program take over generating a page, it's using CGI or something that looks suspiciously similar.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated


In reply to Re: CGI/Perl vs PHP by hardburn
in thread CGI/Perl vs PHP by gilbert0

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.