Если слон на кита влезет, кто кого поборет?

Aug 01, 2006 15:24

А вот что говорят граждане Рольский с Вильямсом (Dave Rolsky, Ken Williams) в книжке «Embedding Perl in HTML with Mason» насчёт отношения перла с библиотеками (в частности, с масоном) и пхп: Chapter 1: Introduction
…Alternatives to Mason
…PHP



PHP http://www.php.net/) is pretty far removed from Mason, but we mention it here because of its popularity. PHP is another mechanism for embedding functionality into webpages, but PHP does not use Perl as its scripting language. The name PHP can refer variously to the embedding system itself, the scripting language, or the interpreter that renders the HTML pages.

It is important to understand some of the properties of PHP before deciding touse it. One of the design goals of PHP is to be as simple as possible to install and start using, and in some cases this means that features that experienced Perl programmers rely on are not present. For instance, PHP lacks support for private namespaces, there is no way to create three-tiered applications that separate business logic and presentation code, and there is no mechanism for creating reusable code modules. The Apache mod_php module is only a content generation module, so it cannot cooperate with other request phases in the same way Mason can cooperate with mod_perl's authentication or filename translation phases. Importantly, although there is a lot of user-contributed code in the PHP world, it cannot match the breadth and depth of Perl's CPAN. It has often been said that the CPAN is Perl's «killer app,» and programmers most appreciate the CPAN when they least expect it.

Finally, although you can theoretically use PHP for general-purpose programming, it wasn't designed for that. PHP is typically used only for embedding PHP code into templates, whereas Perl is a full-featured programming language used for more purposes than any single programmer could imagine. While this does make PHP well-suited for the common tasks of web scripting, it may be limiting. For instance, a certain Perl programming friend was recently contracted to write a «simple shopping cart system» that had one small addition: it had to do some horribly complex optics calculations. For situations like these, a general-purpose programming language like Perl can be quite handy.

holywar, php, программизм, книга, perl, цитата

Previous post Next post
Up