in reply to Perl or php for database edits?

Would the glorious perl monks suggest perl or php for putting up a web-based a simple database record editor.
You must be crazy, asking that on perlmonks!

PHP can be used, but Perl will pay off more in the long run unless you never plan on expanding beyond a small application.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: Perl or php for database edits?
by hmerrill (Friar) on Oct 01, 2002 at 21:00 UTC
    I'm not trying to start a religious war here, and I do love Perl, but I just can't squander this opportunity to debate with one of the most holy monks, Randal Schwartz :-)

    One disclaimer before I start - I haven't used PHP in over a year, so things may have changed in the PHP world, for better or worse.

    My experience with PHP was mostly a positive one - I found PHP to
    * be very fast, as we had compiled PHP into Apache. * be nice to program web applications with - right out of the box(with no additional modules or packages), you get the ability to mix PHP programming code in with html. This was new for me, but I quickly grew to like it - A LOT! * come stock with a lot of great web stuff, including a session management framework that allows you to setup session management in flat files or in the database of your choice, relatively easily. The "cons" I found, in comparison to Perl, were * Perl has(had?) better documentation * Perl has a better code repository * Perl has DBI which is the *excellent* Perl "standard" for interfacing to a database using a database "independent" interface. This allows you to write code that is NOT dependent on any one specific database - therefore, the code allows you to port to a new database with a minimum of effort. Perl DBI also has an excellent mailing list, with LOTS of very experienced people waiting to answer questions. At the time(still?), PHP had no equivalent agreed upon "standard" database independent api. I ended up writing my own database independent layer in PHP.
    So, I wouldn't hesitate to recommend PHP to anyone doing web development. But before jumping to PHP, especially if you're using it to interact with a database, check to see if PHP now supports a "standard" database independent interface. That said, I still love Perl, and also would recommend Perl for *any* programming task.
      * be very fast, as we had compiled PHP into Apache.
      mod_perl is extremely fast. See the success stories at http://perl.apache.org.
      * be nice to program web applications with - right out of the box(with no additional modules or packages), you get the ability to mix PHP programming code in with html. This was new for me, but I quickly grew to like it - A LOT!
      There are about 30 different ways of mixing HTML and Perl in the CPAN. And what's with this obsession with "out of the box"? I can type one CPAN command to install all of Mason or Template or HTML::Template or EmbPerl. And this way, I can choose which model I want to use, not a lock-in with the One Only Way of PHP.
      * come stock with a lot of great web stuff, including a session management framework that allows you to setup session management in flat files or in the database of your choice, relatively easily.
      Again, one command away, and I have everything you ask. Apache::Session and friends comes to mind.

      -- Randal L. Schwartz, Perl hacker

          mod_perl is extremely fast. See the success stories at http://perl.apache.org.

        Granted, mod_perl is extremely fast. I've only done very little mod_perl programming, but what I have done illustrated to me that mod_perl is not trivial to setup - it is very powerful, but with that power and performance comes some complexity. Just my opinion :-)

          There are about 30 different ways of mixing HTML and Perl in the CPAN. And what's with this obsession with "out of the box"? I can type one CPAN command to install all of Mason or Template or HTML::Template or EmbPerl. And this way, I can choose which model I want to use, not a lock-in with the One Only Way of PHP.

        Again, granted. Perl has had many great modules developed to enable people to program websites more easily. But, you have to choose one, and learn it, and then use it to create your website. With PHP, there is one way to do it - no other packages to know, or download - even if downloading and installing is only a 1-step process.

        I'm not attacking Perl - really I'm not! I'm just trying to present PHP as a likable alternative to Perl *for web application programming*. PHP was designed from-the-ground-up for that purpose, whereas Perl was not. If you like Perl, then definitely Perl is a very stable, mature environment where you can find modules that either already do, or make easier, almost any task you need to have programmed - including web development.

Re: •Re: Perl or php for database edits?
by jordanh (Chaplain) on Oct 01, 2002 at 19:48 UTC
    Yeah, coming to Perlmonks to ask if PHP should be used is just begging for abuse.

    Maybe he should go with the PHP, seeing as he apparently enjoys abuse. :-)