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

后端 未结 12 1384
没有蜡笔的小新
没有蜡笔的小新 2021-02-12 15:09

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 wi

12条回答
  •  眼角桃花
    2021-02-12 15:25

    The aforementioned Catalyst is a fine tool for constructing entire web applications, but it is by no means anywhere near simple. The primary strength of PHP is that you can embed small chunks of it as needed in otherwise static pages, i.e. you can do:

    The value of 2+2 is:

    and see on your web browser:

    The value of 2+2 is: 4

    If you try to do something like this with Catalyst (as far as I know), you're developing an entire application with multiple files to print a simple value. At least, there's no explanation of how to do simple embedding in the tutorials that I saw.

    Fortunately, this level of simplicity can be reached with Mason, which in some ways (thanks to the power of Perl) can be even simpler. The above example reads:

    The value of 2+2 is: <% 2+2 %>

    and you get the same result.

    There's no reason you can't start by installing and working with Mason and then install Catalyst side by side with it, however, if you plan to move to very complex, purely Perl-driven projects later, though.

提交回复
热议问题