Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Switching from PHP to Perl/Mason

by alexander_lunev (Pilgrim)
on Feb 07, 2023 at 09:30 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found