Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI newbie, using active perl, on NT

Status
Not open for further replies.

mckarl

Programmer
May 5, 1999
147
GB
oki doki everyone!!&nbsp;&nbsp;(is it me or has andybo been the helpfullest person on tek-tips since ever)<br><br>i am trying to learn to CGI script, using perl. (cos if i was using anything else, activeperl wouldnt work now would it :) )<br><br>i got my HTML:<br>------------------------------------------------------------<br>&lt;HTML&gt;<br>&lt;TITLE&gt; -- Name CGI script -- &lt;/TITLE&gt;<br><br>&lt;BODY&gt; <br>&lt;P&gt; Welcome to my name CGI script. &lt;/P&gt;<br>&lt;P&gt; Please Enter your name and other details in the prompts below, click submit when you have entered your details, or reset to clear. &lt;/P&gt;<br><br>&lt;FORM METHOD=POST ACTION=&quot;details.cgi&quot;&gt;<br>&lt;PRE&gt;<br>firstname &lt;INPUT TYPE=&quot;text&quot; NAME=&quot;fname&quot; MAXLENGTH=15 SIZE=15&gt;<br>surname&nbsp;&nbsp;&nbsp;&lt;INPUT TYPE=&quot;text&quot; NAME=&quot;sname&quot; MAXLENGTH=15 SIZE=15&gt;<br>email add &lt;INPUT TYPE=&quot;text&quot; NAME=&quot;email&quot; MAXLENGTH=35 SIZE=35&gt;<br>&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send Mail&quot;&gt;<br>&lt;INPUT TYPE=&quot;reset&quot;&nbsp;&nbsp;VALUE=&quot;Clear Details&quot;<br>&lt;/PRE&gt;<br>&lt;/FORM&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;<br><br>============================================================<br><br>and her's my Perl code:<br><br>------------------------------------------------------------<br><br>read(STDIN,$temp,$ENV{'CONSTANT_LENGTH'});<br>@pairs=split(/&/,$temp);<br>foreach $item(@pairs)<br>{<br> ($key,$constant)=split(/=/,$item,2);<br> $content=~tr/+/ /;<br> $content=~s/%(..)/pack(&quot;c&quot;,hex($1))/ge;<br> $fields{$key}=$content;<br>}<br><br>print &quot;Content-type: text/html\n\n&quot;;<br>print &quot;&lt;HTML&gt;\n;<br>print &quot;&lt;BODY BGCOLOR=#FFFFFF&gt;\n&quot;;<br>print &quot;&lt;CENTER&gt;\n&quot;;<br>print &quot;Thank you &lt;BR&gt;\n&quot;;<br>print &quot;$fields{fname} $fields{lname}&lt;/BR&gt;&quot;;<br>print &quot;I will write&lt;BR&gt;\n&quot;;<br>print &quot;you at &lt;BR&gt;\n&quot;;<br>print &quot;&lt;/CENTRE&gt;\n&quot;;<br>print &quot;&lt;/BODY&gt;&lt;/HTML&gt;&quot;;<br><br>============================================================<br><br>now, as i said before, here are the stats:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>o</font>&nbsp;&nbsp;&nbsp;Windows NT Workstation<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>o</font>&nbsp;&nbsp;&nbsp;Active Perl<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>o</font>&nbsp;&nbsp;&nbsp;I'm thick<br><br>but i have a real big probz. how can i compile a .pl script into a cgi script, <b>without</b> it trying to download it all the time?<br><br>Please help, like i said, i'm just starting up on this whole cgi thingy wotsit so it'll probably sound <i>really</i> silly. <br><br>Thanks to everyone who replies, and those who look at and think i'm insane, and decide not to answer me.<br><br><br>Many thanks again. Karl. <p> Karl<br><a href=mailto:mc_karl@yahoo.com>mc_karl@yahoo.com</a><br><a href= > </a><br> ~ ~ ~ ~<br>
K A R L<br>
~ ~ ~ ~
 
Karl,<br>&nbsp;&nbsp;&nbsp;you might have better luck getting this answered in the cgi-bin or perl forum.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
i diddnt know there was one...<br><br><br>thanks v. much nic...&nbsp;&nbsp;&nbsp;have fun.<br><br>thnx Karl.<br> <p> Karl<br><a href=mailto:mc_karl@yahoo.com>mc_karl@yahoo.com</a><br><a href= > </a><br> ~ ~ ~ ~<br>
K A R L<br>
~ ~ ~ ~
 
If the system tries to download it, I think it is because you are trying to run it from a server that doesn't support Perl. Unless you access the .pl script from a Perl-enabled server (i.e., your hard drive mapped through a local server structure (localhost/some_dir/some_script.pl) rather than direct (file://some_dir/some_script.pl) ), it won't interpret it.<br><br>Hope that helps.<br><br>
 
you don't compile Perl files. CGI is an interface- you can write code in many different languages that will work with CGI, but the most common is Perl. C++ is also used; C++ programs are compiled. However, Perl is interpreted.<br><br>Try renaming your file from &quot;filename.pl&quot; to &quot;filename.cgi&quot;- that's as easy as changing the extension. Also, make sure you have the correct permissions. But as NickBulka said, this thread should probably continue in the CGI-Bin or Perl forum. <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=] :: imotic :: website :: [</a><br>"light the deep, and bring silence to the world.<br>
light the world, and bring depth to the silence.
 
it's over in the cgi-bin thingy now, hhmm... still going on about it though :) hehehe ... thanks for the help all!!<br><br><br>Karl. <p> Karl<br><a href=mailto:mc_karl@yahoo.com>mc_karl@yahoo.com</a><br><a href= > </a><br> ~ ~ ~ ~<br>
K A R L<br>
~ ~ ~ ~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top