cgi scripting using c

This is a discussion on cgi scripting using c within the C Programming forums, part of the General Programming Boards category; >> You will have a big problem fitting your rocket launcher through the door and wind up getting thoroughly soaked ...

  1. #16
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    >> You will have a big problem fitting your rocket launcher through the door and wind up getting thoroughly soaked with the squirt gun about twenty or a hundred times before you can assemble it properly.

    Nice analogy.

    >> Altho I think you may need your head examined on this one, Sebastiani. While I agree there is nothing wrong with using C to do cgi, there is a reason 95% of it is done with perl in real life AFAIK.

    It has a large existing codebase and a relatively short learning curve. And unlike a C program, you generally don't have to have special permissions to execute it!

    >> You can write a functional cgi script in about 5 lines of perl. Using a "lower level" language here is sort of pointless.

    Sure the syntax may be more compact, but the idea that it somehow "harder" to do in C is ridiculous. You would just need a small library of code to interact with the server and you could of course reuse the code, so - your point?
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  2. #17
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    >> Altho I think you may need your head examined on this one, Sebastiani. While I agree there is nothing wrong with using C to do cgi, there is a reason 95% of it is done with perl in real life AFAIK.

    It has a large existing codebase and a relatively short learning curve. And unlike a C program, you generally don't have to have special permissions to execute it!
    Not sure of the relevance of the permissions, *nix (as in your server) files have permissions one way or another anyway, pl scripts must also be executable.

    As for the "large existing codebase" yep, and I wonder how and why that happened and who is responsible? Hmmm.

    About the learning curve, IMO perl is not that easy to learn, certainly it is more iconoclastic than most other scripting languages, or most other languages generally. Which is why I said to the OP, if you don't know it already, then using C will be easier for you.

    Having looked at php a bit, which can be used for server-side activities akin to CGI, I would say that is a better example of an easy to learn language whose ease of use accounts for it's popularity. And (supposedly) it was derived from perl but uses a simplified C style syntax.

    Perl is perl because it was perl before everything else was! So a little respect please
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #18
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    >> Not sure of the relevance of the permissions, *nix (as in your server) files have permissions one way or another anyway, pl scripts must also be executable.

    No? Does it have full access to the file system?

    >> As for the "large existing codebase" yep, and I wonder how and why that happened and who is responsible? Hmmm.

    Ok, I give up. Who?

    >> About the learning curve, IMO perl is not that easy to learn, certainly it is more iconoclastic than most other scripting languages, or most other languages generally. Which is why I said to the OP, if you don't know it already, then using C will be easier for you.

    Well the (ir)regular expression syntax sucks, I'll give you that, but it's still a pretty easy language to learn besides that, IMO.

    >> Perl is perl because it was perl before everything else was! So a little respect please

    I still say it's a squirt gun. But maybe like one of those water cannon models...filled with mace.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  4. #19
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    Well the (ir)regular expression syntax sucks,
    Never heard that one before! but my perspective is a little skewed: most of the regexp stuff I do is in perl, so to me perl regex *is* regex (which, since it is nearly identical to that found in other languages, probably is true anyway).

    And I gotta say I'd rather visit the dentist than use regex.h. I'm thinking of learning to inline perl in C just so I won't have to.

    I still say it's a squirt gun. But maybe like one of those water cannon models...filled with mace.
    Okay now that's cool
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CGI program help please
    By Lince in forum C Programming
    Replies: 3
    Last Post: 08-01-2007, 01:31 AM
  2. testing a cgi script on my computer
    By Bigbio2002 in forum C Programming
    Replies: 1
    Last Post: 12-14-2003, 06:26 PM
  3. CGI Mailing
    By sean in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 04-14-2003, 09:56 PM
  4. Creating my own Scripting language in C++ for CGI
    By stovellpaul in forum C Programming
    Replies: 0
    Last Post: 10-01-2002, 03:41 AM
  5. Problem with cgi script - can't rename files
    By bjdea1 in forum C Programming
    Replies: 2
    Last Post: 12-12-2001, 03:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21