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

Help! I'm not a programmer but need to understand something about the benefits of Perl over C. The project requires several HTML forms written to a Sybase database. The forms are the typical read, write, etc., with various areas of validation to be done. To date, the game plan has been to use Perl w/stored procedures. Now, there is talk about using C instead of Perl. I would love to understand why Perl is my best bet over C. Thanks........

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Perl Vs. C
by lhoward (Vicar) on Oct 30, 2000 at 23:32 UTC
    For your situation here are some of the reasons I'd use to push for perl.
    • Perl has a well-defined DB interface layer, DBI. DBI is database indepandant so if you ever decide to switch to another DB, you can do it with almost no changes to your scripts.
    • w/ apache, mod_perl and Apache::DBI you get cached DB handles, so your scripts aren't constantly disconnecting and reconnecting to the DB server (which can really hurt performance)
    • w/ apache and mod_perl (and optionally Apache::Registry, depending on how you want to do things) your scripts can run inside the web server; this is much faster use no separate process has to be forked.
    • Perl is generally better suited for CGI's because it has a well defined CGI variable parsing library.
    • If you need to do some C stuff you can always use Inline to put C code inline in your Perl programs.

    Originally posted as a Categorized Answer.

Re: Perl Vs. C
by Fastolfe (Vicar) on Oct 30, 2000 at 23:30 UTC
    (What does this have to do with GUI programming?)

    It depends on what you're trying to do. If your stored procedures are going to be doing all of your validation, what is your (Perl|C) part going to do? Just simple form handling and passing off the data to the database?

    I'm not going to go into a comprehensive "Perl v. C" document, since there are dozens of them out there that do a far more complete job than I could here. In this specific case, though, Perl offers a benefit of rapid development time, in that there are modules already in place to do both the CGI stuff and database stuff, so a script to glue those two together in the form of a simple form processor would be pretty easy to write. If this is going to be something that is going to be hit pretty hard by a large number of requests, or if you already have staff on hand better equipped to maintain something in C, that might be your best bet.

    Depending upon the complexity of your features, using the appropriate modules in Perl, you can write a script to do this task very fast with very few lines of code. I'm not familiar enough with C to know how much reusable libraries you can use to perform some of the lower level tasks (parsing the CGI stuff and interacting with the database).

    Originally posted as a Categorized Answer.