how to run perl -cgi scripts

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2008
Posts: 7
Reputation: Narayanank is an unknown quantity at this point 
Solved Threads: 0
Narayanank Narayanank is offline Offline
Newbie Poster

how to run perl -cgi scripts

 
0
  #1
Oct 24th, 2008
i have got xampp1.6.8


when i run this program in localhost

#!"C:\xampp\perl\bin\perl.exe"
print "Content-type: text/html\n\n";
print '<html>';
print '<head>';
print '<meta name="author" content="Kay Vogelgesang">';
print '<link href="/xampp/xampp.css" rel="stylesheet" type="text/css">';
print '</head>';
print "<body>&nbsp;<p><h1>Sairam with MiniPerl</h1>";
print "CGI with MiniPerl is ready ...</body></html>";

it runs

but when it contains perl scripts it does not run as given below

#!"c:\xampp\perl\bin\perl.exe"
print "Content-type: text/plain","\n\n";
print "Welcome to Shishir's WWW Server!", "\n";
$remote_host = $ENV{'REMOTE_HOST'};
print "You are visiting from ", $remote_host, ". ";
$uptime = `/usr/ucb/uptime` ;
($load_average) = ($uptime =~ /average: ([^,]*)/);
print "The load average on this machine is: ", $load_average, ".", "\n";
print "Happy navigating!", "\n";
exit (0);
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: how to run perl -cgi scripts

 
0
  #2
Oct 24th, 2008
as far as I know there should be no quotes on the shebang line:

#!c:\xampp\perl\bin\perl.exe

but you're better off using forward slashes, which Windows fully supports:

#!c:/xampp/perl/bin/perl.exe

backslashes in perl code create escape sequences, not on the shebang line which is a special line in a perl program, but its a good habit to use forward slashes in file/directory paths whenever possible to avoid the problem intirely. Note that DOS does not support forward slashes so if you ever do something in DOS you will have to use backslahes in directory paths.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC