CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
running perl cgi's in a browser

 



waherne
Novice

Feb 9, 2000, 12:51 PM

Post #1 of 8 (1881 views)
running perl cgi's in a browser Can't Post

Hi all,

I have perl loaded on my desktop computer.

I have a perl cgi and text document in the same directory. The function of the perl cgi is to output the document text to the browser. However....

The text never prints to the IE browser - I can see all the text in the perl window. I know the code is fine as I copied it from a book and also checked it against other sources (e.g. content-type is correct)

What else could it be? I open the perl.cgi from within the browser but the cgi just runs in the background and then closes - the browser page never changes or never states that there is an error.

Please help me as my Perl studies are suffering badly.

Willie


Cure
User

Feb 9, 2000, 3:43 PM

Post #2 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

Hi,

Are you running it on your webserver or a companies webserver because some webservers only respond to .pl and not .cgi
try changing it to .pl instead of .cgi

Here's a simple program. Run this first with a .pl and see what happens(if it doesnt work) then try running it with a .cgi extension.---> tell me what happens(thxs)

#!/usr/bin/perl

print "Content-type: text/html\n\n";

cure();

sub cure {

print "Hello, World...\n";

}



[This message has been edited by Cure (edited 02-09-2000).]


waherne
Novice

Feb 11, 2000, 6:01 AM

Post #3 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

Good idea, I will try this and let you know.

Thanks,

Willie

p.s. amy more suggestions are most welcome


RayStreet
Deleted

Feb 11, 2000, 1:02 PM

Post #4 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

What's the program source code? Also, has the browser been configured to run CGI - some browsers need to be explicitly told to run CGI (to stop hackers getting in and just running CGI) - have a word with your sysadmin or webmaster.

Ray


waherne
Novice

Feb 19, 2000, 2:02 PM

Post #5 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

Hi Cure

I ran your script but the same thing happens.

When I open IE5, and go to File/Open myfile.cgi, then Perl works in the background and never outputs to the browser.

Perl closes immediately after running so I dont get a chance to see what messages it is giving.

Help!

Willie


Cure
User

Feb 19, 2000, 8:26 PM

Post #6 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

HI wherne-> please dont give up, I will help you im the windows guru,hehe

1.DO you have apache.
2.are you just trying to run it from your browser from file then open because on my computer when I do that i pops-up a little window then flashes info then disappers
3. If you have apache i can send you my config-file that will allow support ssi taghs and .cgi and .pl
4.you need to run a perl application on a server example->apache windows or a unix server and etc.

because i have apache installed on my computer and i have perl installed to.

the path to my scripta are like this

#!/apache/bin/perl

If you only have perl install then its ,ost likely its like this

#!/perl/bin/perl


Work with me on this and we can fix your problem

you can also perl your script in dos
exampe if you have a script called cure.pl on your desktop

c:\windows\desktop\perl cure.pl

Cure

[This message has been edited by Cure (edited 02-19-2000).]


kencl
User

Feb 27, 2000, 1:41 PM

Post #7 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

Warherne, you need to be running a web server which supports CGIs. If you don't already have one, go to http://serverwatch.internet.com/webservers.html and choose one.


reefland
Deleted

Feb 27, 2000, 6:22 PM

Post #8 of 8 (1881 views)
Re: running perl cgi's in a browser [In reply to] Can't Post

If it closes before yu get a chance to see what it displays, trying running the script from DOS and by typing:
perl -w c:\location\myfile.pl

This will let you know if there are any errors in the script. If the window still closes before you get a chance to see the output, try adding this to the end of it:

print "Press <Enter> to continue...";

This should prevent the window from closing until the Enter button is depressed.

hope this might help.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives