Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

C++ and VB

by Mork29 (Scribe)
on Aug 08, 2000 at 10:04 UTC ( [id://26741]=perlquestion: print w/replies, xml ) Need Help??

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

Obviously Perl is the most common type of .cgi However i hear you can use other languages? How is the coding different, as in, how do i get my server to "read" the c++ files, or the VB files. Does it need an "Interpreter" like in perl?

Replies are listed 'Best First'.
Re: C++ and VB
by t0mas (Priest) on Aug 08, 2000 at 11:25 UTC
    Common Gateway Interface is a way to call a program and return data to the Web-Server. It has really nothing to do with what language your CGI program is written in.
    If you want to write CGI programs in c++ or VB you'll need to compile them so they can be executed in your operating environment and they must conform to the CGI standards to be able to read input and return data to the Web-server.

    /brother t0mas
Re: C++ and VB
by lolindrath (Scribe) on Aug 08, 2000 at 18:12 UTC
    I think that the other languages wouldn't be that different to program CGI with. The variables would be passed through the equilivent of ARGV and you just parse it and go.

    If you look at some webpages you'll see *.dll's handling CGI. But, can you imagine making a change to a Visual Basic program, recompiling it, uploading it, and then trying it just to find that you missed a period and you have to do it all over again?

    The only gripe some people put up is that Executables use less CPU time and memory because Perl has to call the interpreter everytime, this problem is fixed with mod_perl in Apache.

    --=Lolindrath=--

Re: C++ and VB
by ColtsFoot (Chaplain) on Aug 08, 2000 at 11:09 UTC
    When CGI's are referenced that are written in perl, the perl interpreter
    is run. Under *nix the #!/usr/bin/perl line runs the interpreter
    and the script that follows in then interpreted. So if you have an
    executable C++ or VB program then this can be run using:-
    #!/path/to/executable/program
    It does not need an interpreter like perl because the program itself is
    executable
    Hope this helps
Re: C++ and VB
by plaid (Chaplain) on Aug 08, 2000 at 21:56 UTC
    All languages that have a concept of standard input/output and environment variables can be used for CGI. The webserver will set the appropriate environment variables (CONTENT_LENGTH, QUERY_STRING, etc.), and pass any POST data on to the program as standard input. And, as with perl, any data printed to standard output is sent to the browser.

    If you want to check out some source for a CGI written in C, check this page. The util.c file at the bottom of the page is a commonly-used utility to take care of the parsing of query strings. I believe there are security holes in it somewhere, so I wouldn't recommend actually using it, but it's a good thing to look at to understand CGI in other languages. It's also a good thing to look at to see why perl's string parsing is so well suited to CGI.

Re: C++ and VB
by Mork29 (Scribe) on Aug 09, 2000 at 10:22 UTC
    Thank you all for your posts... Clears up alot.... I was surprised nobody called me a blasphemer :) Although Perl is an awesome language, other languages are nice too..... However I think i'll still be doing all my cgi's in perl, that's for sure....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://26741]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found