codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  perl output in browser  emoin at 04:44 on Monday, January 15, 2007
 

Hi,
Am new to perl. I use Apache on HP-UX to direct the output onto a browser. I wrote my first script hello.pl which contains the following commands

#!/usr/bin/perl

# simple hello world cgi script
print "Content-type: text/html\n\n";
print "<html><body>\n";
print "<hr>Hello, world!<br><hr>\n";
print "<hr>Have a nice day!!!<br><hr>\n";
print "</body></html>\n";


The ouput is the following:

#!/usr/bin/perl # simple hello world cgi script print "Content-type: text/html\n\n"; print "\n"; print "
----------------------------------------------------------------

Hello, world!

----------------------------------------------------------------\n"; print "
----------------------------------------------------------------

Have a nice day!!!

----------------------------------------------------------------\n"; print "\n";


Why am i not getting the ideal output (in this case only two lines with Hello World and Have a nice day)???


  Re: perl output in browser  javabits at 18:40 on Monday, January 15, 2007
 

it looks like your apache isn't configured to run your perl script as a cgi. It's just dumping the text of your perl script directly to the browser.

There's no way for anyone to help you without looking at the way apache is configured on that particular machine. Normally in the httpd.conf file you will find something like

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

(Translation allow cgis to be run from the physical directory /var/www/cgi-bin - web server path /cgi-bin/)

or

AddHandler cgi-script .cgi
(Allows the use of cgi scripts outside of ScriptAliased directories, scripts must end with .cgi)

In your case you would need something like
AddHandler cgi-script .pl

(since your script is named hello.pl)

semper fi...











CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Small Java Program Help
•  Re: perl output in browser
•  adding delay to menu
•  Some questions about JS.
•  Some questions about JS.
•  Applying discount
•  Re: Hello...
•  Please Help Javascript College Assignment
•  PDF manipulation


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007