KPeter0314 has asked for the wisdom of the Perl Monks concerning the following question:

It seems that php is also a popular language for database access.

Would the glorious perl monks suggest perl or php for putting up a web-based a simple database record editor.

Sitiuation:
- mySQL
- single table
- hopefully password protected
- simple add/modify/delete fuctions

Possible expansion of functionality later, but this is what I am looking at now.

Replies are listed 'Best First'.
(jeffa) Re: Perl or php for database edits?
by jeffa (Bishop) on Oct 01, 2002 at 19:14 UTC
    Hmmmm. I would like to know a few more of your requirements before giving a confident answer. Questions such as:
    • What is your Perl experience?
    • What is your PHP experience?
    • How soon does this need to be accomplished?
    • Do you know mod_perl?
    The reason i ask these questions is that i myself have been dabbling in PHP lately, due to my new job which requires it. Up until this point i scoffed PHP, thinking it to be a kiddie version of Perl. This is not true at all. PHP is actually quite useful, powerful, and fast. Perl can do everything that PHP can do and probably do it better, but PHP can do it right now and generally in an easier fashion for someone who does not have a lot of experience with Perl.

    So, with that in mind, if you really foresee a lot of complexity ahead of you, you should consider Perl. If you really believe that this project will be fairly simple, give PHP a shot. I recommend you check out the O'Reilly book Programming PHP and definitely check out Smarty, PHP's HTML templating engine.

    But ..... good luck finding a community like this one for PHP when you need assistance. >:)

    UPDATE:
    Re: your reply ... stick with Perl! :D With the many CPAN modules available, you should have no trouble writing glue code to create your app.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      Just to answer the questions:
      • Moderate Perl experience
      • low PHP experience, but willing to learn
      • It needs to be done when I get around to it, so a learning investment is OK with me
      • mod_perl is (hopefully) a friend

      I use phpMyAdmin for the database design and setup. I just don't want the other people who will have web access to get confused with all the options there.

      A simple view of the data with editing capabilities is what I want. I would prefer Perl, of course, which is why I am here at the monastery.

      -Kurt

Re: Perl or php for database edits?
by ignatz (Vicar) on Oct 01, 2002 at 19:13 UTC
    Yes.
    ()-()
     \"/
      `                                                     
    
•Re: Perl or php for database edits?
by merlyn (Sage) on Oct 01, 2002 at 19:18 UTC
    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

      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

      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. :-)

Re: Perl or php for database edits?
by hiseldl (Priest) on Oct 01, 2002 at 19:18 UTC

    There are Perl database editors out there such as MySqlMan. However, if you want to extend your application later to non-web based applications, then Perl is definitely the way to go.

    --
    hiseldl
    What time is it? It's Camel Time!

Re: Perl or php for database edits?
by KPeter0314 (Deacon) on Oct 01, 2002 at 19:40 UTC
    OK, leave PHP out of it. Perl is the way to go.

    Can somebody suggest a pre-written tool to do a read-and-learn from?

    I don't need a whole bulldozer with attachable gadgets (e.g. either MySqlMan or phpMyAdmin) for this application, just a simple shovel will do. In other words, I just want to give display a table and be able to edit the entries.

    Preferably simple and elegant.

    -Kurt

      Not a standalone application, but Webmin (http://www.webmin.com) is a system administration suite written in Perl. It has a decent MySql administration module available which is, of course, also written in Perl. I have to agree though, I have been very impressed with PHPMyAdmin for administering MySql. The same and more could certainly be done with Perl, I just haven't seen a packaged version out there yet.
Re: Perl or php for database edits?
by peacemaker1820 (Pilgrim) on Oct 01, 2002 at 20:40 UTC
Re: Perl or php for database edits?
by BUU (Prior) on Oct 01, 2002 at 21:23 UTC
    Just to mention it (as no one had) there is also a PerlMyAdmin on sourceforge. That has a lot of the same functionality. While its not as nice as phpmyadmin..
Re: Perl or php for database edits?
by Abstraction (Friar) on Oct 01, 2002 at 21:31 UTC
    Perl, no questions. DBIx::HTMLView looks like it would be a good starting point for this project

    DBIx::HTMLView - For creating web userinterfaces to DBI databases.