As PHP is directly included in your webpages, it is more akin to working with a templating framework in Perl. Examples are HTML::Embperl, Template Toolkit or HTML::Template and such.

An MVC framework such as Catalyst makes extensive use of this. Perl does all the heavy (computational and database) lifting, the template allows you to write your webpages quite easily and an OO-wrapper around your database makes for an easy and consistent access to your data.

At first --and to many a PHP programmer-- this seems unnecessarily complex, but actually it makes for far cleaner code. Changing the data-store is done only in the model-layer (which is mostly just some config-files), the business logic is found in the Perl code in the controllers and the eye-candy for your web-page is found in the view layer of the templates. You will be hard-pressed to maintain such a nice separation of concerns in your PHP-application.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


In reply to Re: Migrating from PHP to Perl for the web. by CountZero
in thread Migrating from PHP to Perl for the web. by KurtSchwind

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.