Teen Programmers Unite  
 

 

Return to forum top

Questions again! thanks

Posted by Perl [send private reply] at January 21, 2003, 06:42:31 PM

Thanks for everyone help!!

i need to ask questions again...

1)Do i need to configure my servers to accept cgi or i just place my cgi on the server wait for it to activite??

2)Must i really use a server for my cgi, can i place it on my own workstation for testing which mean my own workstation is the server as well as the client??

Thanks you!

Posted by gian [send private reply] at January 21, 2003, 08:22:27 PM

Why can't you reply to your previous thread with any subsequent questions as opposed to starting a new thread?

But to answer your questions:

1) Yes, you do. If your server isn't configured, it won't know what to do with a cgi file.

2) You can easily run a web server on your desktop computer... it just runs in the background and you access it via http://localhost/

Posted by Perl [send private reply] at January 21, 2003, 09:14:56 PM

sorry gian, i dun quite understand how to run the localhost...

do i need to install anything like i need to install tomcat when running iava servlet on my own pc, which acts as a server.??

Posted by gian [send private reply] at January 21, 2003, 09:16:15 PM

Yes, you do. I would recommend Apache (http://httpd.apache.org/).

Posted by taubz [send private reply] at January 21, 2003, 10:04:47 PM

Apache is moderately difficult to configure, though. I used to use OmniHTTPd like 6 years ago. Maybe it's still around.

- taubz

Posted by Perl [send private reply] at January 21, 2003, 11:50:18 PM

hi taubz, but the OmniHTTPd support only Windows 95/98 and Windows NT...my pc is win2k...any other choices??

Posted by Perl [send private reply] at January 22, 2003, 12:49:13 AM

sorry, OmniHTTPd does support w2k..

one more question...

i know that cgi can be written in Perl and can return HTML outputs..
but is it just plain normal layouts?? can it returns with more beautiful layouts?? do u know what i mean??

For example using pure HTML enables us to design our layouts more freely...but once u have to use perl to generate HTML outputs...will we be more restricted??? like layouts, colors, pic... etc

Posted by CViper [send private reply] at January 22, 2003, 01:18:24 AM

nope, just have your perl-cgi output the nice HTML design. CGI's aren't a restriction, you can output whatever you want...

To see this, you can simple read a "standart" HTML page and write it to stdout in the perl script. You'll see, that it looks exactly like the HTML page if you'd loaded it directly. (Afterall it's the same data)

Posted by Perl [send private reply] at January 22, 2003, 01:31:43 AM

ok..thanks for all the troubles..but i scare i will have to continue troubling u guys..cos i'm really newbie in perl...

thank you

Posted by Perl [send private reply] at January 22, 2003, 02:03:38 AM

one more question..thank you

1)how come i can run cgi-perl scripts using DOS?? i thought the cgi-perl scripts must be in the server to be activiate???

and i can run normal perl applications using DOS..

2)how do i know if it is a cgi-scripts?? how do i identify a cgi-scripts??

for example:
print "Content-Type: text/html\n \n";


Posted by gian [send private reply] at January 22, 2003, 03:39:00 AM

Perl is just a command line interpreter for the perl language... CGI is a way to output the results of executing the script to a web browser.

Posted by CViper [send private reply] at January 22, 2003, 06:01:20 AM

btw: that should be "Content-Type: text/html\r\n" with a <crlf> (= '\r\n') in the end, not 2 line feeds (= '\n\n').

Posted by Perl [send private reply] at January 22, 2003, 08:26:28 AM

Thank you.

How abt question one?? anyone know??

Posted by mop [send private reply] at January 22, 2003, 09:22:39 AM

apache comes with a folder called "cgi-bin" in the initial install, any scripts in it it will know to execute

Posted by taubz [send private reply] at January 22, 2003, 11:07:37 AM

No, it needs to be two linefeeds. On Unix, \n\n is correct. On Windows, that should work too I'd imagine, otherwise \r\n\r\n. (One to end the line, one to end the headers.)

- taubz

Posted by CViper [send private reply] at January 22, 2003, 01:08:01 PM

*takes his doc's and throws them out of the window*

it said it should be <crlf>, and it does work with my cgi's (running on a linux machine) - whatever.

Posted by Perl [send private reply] at January 23, 2003, 12:03:19 AM

Hi..Does anyone know what is Perlipc...think it stands for perl interprocess communication...

i know it is abt client and server communication stuffs..

does anyone more details abt this?? thank you.

Posted by taubz [send private reply] at January 23, 2003, 01:54:09 AM

You shouldn't need that... Interprocess communication means two processes (programs) on the same computer talking to eachother in a particular way.

- taubz

Posted by Perl [send private reply] at January 23, 2003, 02:13:45 AM

no need??

but if i want my webserver to communicate with my main server...i need some sort of communication sockets..rite??

since i'm using perl to set up the whole communication things...

i shld have to establise something on both webserver and the main server so that webserver can retrieve information from the main server and then the webserver will display the info on the client GUI...rite??

last time i did a 3D multi-players lan game project..although i did more on the graphics sides than the network sides..
but i know my fri got program some win sockets so tht they can communicate...

am i rite?? i'm confuse too...help..thank you

Posted by gian [send private reply] at January 23, 2003, 03:39:23 AM

You don't need to worry about any of that.

It is simple:

First, someone visits the URL of a perl script on your webserver. Upon seeing this request, the webserver spawns the perl interpreter to run that script, capturing the output as it goes. It then outputs the results of the interpreter running that script to the client as opposed to the perl source. You just need to print stuff out in the usual perl manner... your webserver program takes care of all network stuff.

Posted by taubz [send private reply] at January 23, 2003, 12:30:31 PM

Why don't you go through a Perl tutorial to find out how easy it is to get it going and to see what it does and doesn't do.

- taubz

Posted by regretfuldaydreamer [send private reply] at January 23, 2003, 05:05:23 PM

Perl, if you spend a day trying these things out yourself, which I agree would be very fustrating, you will learn a hell of a lot more than sitting doing nothing(I know you're doing something, but you get what I mean, right?) and waiting a day for someone to satisfactorily answer your questions here. (That wasn't criticism by the way, just my personal opinion).

Posted by Perl [send private reply] at January 23, 2003, 07:32:10 PM

hi gian..i can understand what u r talking abt..

I understand that the scripts on the webserver is activated by the URL requests..all i have to do is to write the codings that will ouptout the results rite??

but what happen if my scripts on my webserver need to communicate with another server...for retrieving the info..and then the scripts will get the info and display to the clients..

the pro is..is there a need for me to set up something between the scripts on my webserver to the main server(contain the info)???

Thanks you

Posted by Perl [send private reply] at January 23, 2003, 07:32:51 PM

hi..thnk for all the comments and answers..

i did search the net for the perl information....but there is always something we cant find in the net too..that is y i came here and ask..and everyone is so helpful..thank you!!

i have only 5 days to one week to learn how to write cgi using perl and then have to start setting up all the things

Posted by Perl [send private reply] at January 23, 2003, 10:01:45 PM

i had already gone through alot of tutorials..but i dun perl interprocess communication tutorial can be found...

anyone understand perlipc??

Posted by taubz [send private reply] at January 24, 2003, 12:33:50 AM

You need to learn Perl well before you start playing with IPC. Regular sockets are probably a bit easier, but Perl does not do this stuff very nicely.

- taubz

Posted by Perl [send private reply] at January 24, 2003, 12:44:30 AM

hai...i know..taubz..currently i'm doing the client side ..after everything is done, i have to process to this stupid IPC..Hope can finish it in a month time..thanks for yr reply.

Posted by mop [send private reply] at January 24, 2003, 01:48:01 AM

perl in this use is server side, what type of project are you working on, anyway?

Posted by buzgub [send private reply] at January 25, 2003, 11:49:29 PM

If you need to request another web page from a perl CGI script, you should google for libwww-perl.

Be aware that this will cause your web page to have a pretty shonky response time.

Posted by Perl [send private reply] at January 26, 2003, 09:02:09 PM

Thanks for everyone help!!

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.