Hello and welcome (back)!

If someone asks me to rewrite PHP web site to Perl, I would start with data that needs to be entered, processed and displayed, and enclose all data work in a module. It would be simpler to write, maintain and test this data module alone without presentation stuff. Suppose you already have some middleware (how would you process HTTP/CGI requests - with web server like apache/nginx, I guess), and then to presentation: if it's just a page with simple HTML, which is used just to get parameters from forms and process it - you can use your data module in a simple CGI script. If your old PHP site was driven by many .php files, I would definitely look at some framework (I'd suggest Mojolicious here), so you can process requests, parameters and routing in a framework, and still keep your data logic in your module, while presentation could be simple HTML (all framework have templates for this), unless you need a complete front rework to an interactive site - then your path would lie in a valley of JS (which is not bad at all, if you ask me).

The main idea is a separation of concerns, when you can choose right tool for right thing, so in the future, when you would need to rework again this site to some new presentation, or logic, or middleware, you would just pull one part and replace it with another. You may rewrite your data module in another language, or you can replace HTTP/CGI framework to some command line interface, etc.


In reply to Re: Switching from PHP to Perl/Mason by alexander_lunev
in thread Switching from PHP to Perl/Mason by erickp

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.