Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get PHP's (deployment) simplicity but Perl's power?

Tags:

php

perl

I despise the PHP language, and I'm quite certain that I'm not alone. But the great thing about PHP is the way that mod_php takes and hides the gory details of integrating with the apache runtime, and achieves CGI-like request isolation and decent performance.

What's the shortest-distance approach to getting the same simplicity, speed and isolation as PHP's runtime environment, with Perl semantics? I feel like raw mod_perl gives me too much rope to hang myself with: cross-request globals, messy config, too many template engines to choose from.

FastCGI? HTML::Mason? I'd like to do development largely in Perl, if only I had a framework that let me.

like image 461
djsadinoff Avatar asked Sep 25 '08 20:09

djsadinoff


4 Answers

Look at Catalyst this MVC (model, view, controller) framework works stand-a-lone or with apache_perl and hides a lot of the messy bits. There is a slightly odd learning curve (quick start, slower middle, then it really clicks for advanced stuff).

Catalyst allows you to use Template Toolkit to separate the design logic from the business logic, Template toolkit really is great, even if you decide not to use Catalyst then you should be using this. HTML::Mason isn't something I personally like, although if you do all the HTML yourself then you might want to review Template::Declare which is another alternative you can also use with Catalyst.

For database stuff look at DBIx::Class, which yet again works with Catalyst or on it's own.

like image 200
Ranguard Avatar answered Nov 08 '22 13:11

Ranguard


I just saw Dancer. Looks like this might be a good option.

like image 43
djsadinoff Avatar answered Nov 08 '22 13:11

djsadinoff


The closest, well-regarded equivalent to PHP in Perl is probably HTML::Mason.

Like PHP, it embeds Perl into your document and renders it:

% my $noun = 'World';
Hello <% $noun %>!
How are ya?

The O'Reilly book Embedding Perl in HTML with Mason is available online for free.

like image 6
xdg Avatar answered Nov 08 '22 15:11

xdg


I'd recommend Catalyst with FastCGI. Also, for templating, Template::Toolkit is my personal favorite, but HTML::Mason is also highly regarded in the community.

like image 6
Adam Bellaire Avatar answered Nov 08 '22 15:11

Adam Bellaire