homepage Welcome to WebmasterWorld Guest from 54.196.168.78
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
browser page is showing empty
hello world program
ravi




msg:3798866
 6:21 am on Dec 3, 2008 (gmt 0)

Hi,

I am very new to CGI/PERL.I tried to run the hello world program but my browser is showing the page empty.

I changed the permission also to 755.

#!/usr/bin/perl
print "Content-Type: text/plain", "\n\n";
print "Hello World in Perl", "\n";

 

mikeyb




msg:3799028
 11:41 am on Dec 3, 2008 (gmt 0)

Hi,

Not sure your content-type line is correct, not seen it done like that before, try this:

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Hello World in Perl", "\n";

Or it should be this if your going to be outputting HTML:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello World in Perl", "\n";

rocknbil




msg:3799112
 2:14 pm on Dec 3, 2008 (gmt 0)

Perl prints comma -separated lines as well as full double quoted lines. Although you'd most often use text/html as your content-type, text/plain should also be fine.

my browser is showing the page empty.

There is nothing wrong with your script "as presented" so my guess is there are only two possible problems, and they are working in combination.

1. Path to perl might be wrong. #!/usr/bin/perl is standard, but some servers might need #!/usr/local/bin/perl or other path (rare, but possible.)

2. Generally, if the above condition is true, you *should* get a 500 Internal Server error. However, the white page tells me there is something astray with your server configuration that is not correctly handling CGI errors, hence, the white page. I have seen this and it makes scripts really hard to debug (given that they are working offline.)

A corollary possibility is that your server is just not executing your code. If CGI and perl support were not enabled, it would just display the script as a plain text file, so it's not that.

Are you executing this script in an area the server allows script execution? Example, many servers will only allow script execution from the cgi-bin. Try to run the script in the domain root and it will error, print the script as plain text, or . . . give you a white page. :-)

These should give you enough into to start figuring it out.

phranque




msg:3799410
 8:18 pm on Dec 3, 2008 (gmt 0)

you could always try checking the server logs for clues.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved