Closed Thread Icon

Preserved Topic: Help with a Perl Script. (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17806" title="Pages that link to Preserved Topic: Help with a Perl Script. (Page 1 of 1)" rel="nofollow" >Preserved Topic: Help with a Perl Script. <span class="small">(Page 1 of 1)</span>\

 
foam
Bipolar (III) Inmate

From: Fontana, Ca, USA
Insane since: Jun 2000

posted posted 06-16-2000 18:44

Hey guys, i got this much of the script done and it wont seem to work, can soemone help me out and tell me whats wrong with it?

thanks

#!/usr/bin/perl
use CGI;

#############################
#
# This Forum copyright Scott Hedstrom
# No unauthorized Use.
#
#############################
#
# Start of Development: June 15, 2000
# End of Development: TBA
#

#Define These Variables

$forumname="foamFORUM" #The name of the forum here

$outputfile="foruminput.txt" #This file is where the script will write to. Use it for an SSI

$sendsite="http://panzone.com/foam/forum.shtml"> #The location you want themto be sent after message submition.

# This creates an instance of the CGI object.

$cgiobject = new CGI;

# This gets the values of forms submitted by the user.

$username=$cgiobject->param("username");

$message=$cgiobject->("message");

# End of Variable Info

#Opens the Output file for input.

open(outfile, "+>$outputfile") &#0124; &#0124; die;

# End of File copying

#Start of file writting.

print outfile "$message\n\n\n";

close(outfile); #Closes the file.

# Creates the webpage

print "<HTML><HEAD><TITLE>$forumname</TITLE></HEAD>
<BODY>Message Submitted.</BODY></HTML>"


Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 06-16-2000 23:27

I don't have CGI.pm on my puter. Where can I get it?

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-19-2000 18:13

1) U did not have message labled with ->param

2) For open file, I don't think u need the + sign. I have never seen that used before. it should just be > , < , or >>.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-19-2000 19:33

Boudga

Here is a link for the CGI.pm module
http://stein.cshl.org/WWW/software/CGI/#installation
Foam Warmage is right you should not need the '+' to open the new file, '>' opens a new file for writing. You also need the param on both variablesto load them into the variable ($message=$cgiobject->param("message") <img border=0 align=absmiddle src="http://www.ozones.com/forum/wink.gif">

My last tip is the Perl debugger. If you are familiar with telnet you can telnet into your server and what you do is navigate to the path of your script and then type the name followed by (usually) a -d so 'whatever.cgi -d' this might help you debug your code
Warmage the param statement is part of the CGI perl module, if you are not familiar with it you should it's the best way for interacting with forms in Perl.

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-19-2000 23:38

no, I was saying that he has it labled:

$message=$cgiobject->("message");

when it should be:

$message=$cgiobject->param("message");

If you are talking about the open(outfile, "+>$outputfile")

« BackwardsOnwards »

Show Forum Drop Down Menu