Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Switching from PHP to Perl/Mason

by alexander_lunev (Pilgrim)
on Feb 07, 2023 at 09:30 UTC ( #11150208=note: print w/replies, xml ) Need Help??

in reply to Switching from PHP to Perl/Mason

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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11150208]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2023-04-02 09:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found