Gossamer Forum
Home : General : Perl Programming :

Help with a perl script

(Page 1 of 2)
> >
Quote Reply
Help with a perl script
Hi!
I have been making a script for a computer party and I can't get it work.
It's a form script that sends a mail to the webmaster and stores the information in a file.
The error I get is this:

Software error:
Execution of /home/p/pt/pt-home/public_html/my address/cgi/dataparty.cgi aborted due to compilation errors.
For help, please send mail to the webmaster (drift@powertech.no), giving this error message and the time and date of the error.


......
I included the file as an attachment.

Last edited by:

brewt: May 12, 2011, 12:18 PM
Quote Reply
Re: [perlman] Help with a perl script In reply to
Well you should check your error log and/or run it from telnet but I can see several errors.

Firstly:

$mottaker = 'adresami\@hotmail.com';

You don't need to escape the @ when using ' '

Next you print html and then go straight into if () { without ending the html

You don't print any header.

You should really use CGI.pm....much more flexible.

if ($var == ' ') { isn't really correct.

You'd want

if (! $var) {

or

if ($var eq '') {

or

if ($var =~ /^\s*$/) {

Last edited by:

Paul: Apr 14, 2002, 2:07 AM
Quote Reply
Re: [Paul] Help with a perl script In reply to
Oh also $ENV{CONTENT_LENGTH} is spelt wrong ;)

>>%ENV{'CONTENT_LENGHT'}<<

Should be:

$ENV{CONTENT_LENGTH}


....and you use $FORM but it isn't defined anywhere.

Looks like you've been mashing scripts together Angelic

Edit:

Opps you need a \n after all these lines too:

print MAIL "To: $mottaker";
print MAIL "From: $dataparty";
print MAIL "Subject: Påmelding til dataparty.";

Last edited by:

Paul: Apr 14, 2002, 2:36 AM
Quote Reply
Re: [Paul] Help with a perl script In reply to
Thanks for responding.
The script had many things wrong.
I have tried to fix the things that were wrong.
But I still get the same error.
Can't use telnet to check the errors.
And I don't want to use CGI.pm.
Don't like it.
And I don't need so many things to the script.
Take a look at the script again and try to find the things that are wrong.
Thanks again.

Last edited by:

brewt: May 12, 2011, 12:18 PM
Quote Reply
Re: [Paul] Help with a perl script In reply to
In Reply To:
Opps you need a \n after all these lines too:

print MAIL "To: $mottaker";
print MAIL "From: $dataparty";
print MAIL "Subject: Påmelding til dataparty.";

You actually need 2 \n (newlines) after the subject before moving onto the body.

- wil
Quote Reply
Re: [Wil] Help with a perl script In reply to
Fraid not, not when you have a reply-to below it Tongue
Quote Reply
Re: [Paul] Help with a perl script In reply to
Which you haven't got ... Unsure

- wil
Quote Reply
Re: [Wil] Help with a perl script In reply to
Um so what's this then?

print MAIL "Reply-to: $FORM{'Email'} ($FORM{'navn})\n\n";
Quote Reply
Re: [Paul] Help with a perl script In reply to
I dunno. I haven't looked at the OP. I was just quoting your code. :-)

- wil
Quote Reply
Re: [Wil] Help with a perl script In reply to
I was taking the whole script into context and so \n\n wasn't needed after the subject and you were just looking at the 4 lines I pasted :)
Quote Reply
Re: [Paul] Help with a perl script In reply to
I'm getting confused!!
What should I do?
I now have \n after To: From: and Subject:
and I have \n\n after Reply-to:
What's wrong?
You are confusing me with all this rubbish.
Give me a straight answer of what's wrong!
Please!
Quote Reply
Re: [perlman] Help with a perl script In reply to
Im not sure I like the tone of that reply especially after I've obviously just wasted part of my Sunday afternoon helping you.

My last words are to check your error log.

Last edited by:

Paul: Apr 14, 2002, 12:41 PM
Quote Reply
Re: [Paul] Help with a perl script In reply to
Sorry for that reply.
I was just so confused when you started to "fight" with Wil about \n and \n\n!!
I don't think I have a error log.
Or in other words I don't know where it is.
(I'm no expert!)
Thank you for helping me!
I'm greatful!

Last edited by:

perlman: Apr 14, 2002, 1:04 PM
Quote Reply
Re: [perlman] Help with a perl script In reply to
In Reply To:
(I'm no expert!)

Then why the moniker Perlman?

Smile
Quote Reply
Re: [Mark Badolato] Help with a perl script In reply to
http://names.freehosting.net/dirty.html

Sorry, couldn't resist Laugh ....I had no idea what "moniker" meant and that's what came up.

Last edited by:

Paul: Apr 14, 2002, 1:14 PM
Quote Reply
Re: [Mark Badolato] Help with a perl script In reply to
I'm really bad at creating cool names to!
Perlman = The man that tries very hard to learn Perl, but are having big problems!

And does somebody know what's wrong with my terrible script?
Just wondering....

Last edited by:

perlman: Apr 14, 2002, 1:16 PM
Quote Reply
Re: [perlman] Help with a perl script In reply to
Its difficult to say without knowing the error. Can you not whizz off an email to your host to at least find out if you have access to an error log?.....if so it would make things much easier.
Quote Reply
Re: [Paul] Help with a perl script In reply to
Hi Paul.
I cheched it out and there's no way for me to get the error log.
I don't know what to do!!
I have to be finish with this script soon.
Don't know what's wrong.
Please help me out here!!
Quote Reply
Re: [perlman] Help with a perl script In reply to
Ok, as Paul said, use CGI.pm. Add the following after the fatalsToBrowser part;

Code:
use CGI;
my $input = new CGI;

Then get rid of the following, as it is redundent now;

Code:
read(STDIN, $buffer, %ENV{'CONTENT_LENGHT'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs);
($name, $value) = split(/=/, $pair);
$value =~ /+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;

Then change all references of $FORM{'stuff'} with either $input->param('stuff'); (obviously change 'stuff' with the appropriate variable being sent.

On one of your lines you have;

Quote:
diencie("Du har glemt å fylle ut noe i epost feltet. Vennligst gå tilbake å fyll ut alle felter.\n");

Notice that you have 'diencie', instead of 'dienice'...may wanna fix that too Wink

Mmm..there is a lot of error here ;)


Code:
print MAIL "Subject: Påmelding til dataparty.";

I would change that to something like;

Code:
$subject = "Påmelding til dataparty.";
print MAIL "Subject: $subject \n";

Also, at the end of the subject, to and reply-to lines, you need a single \n, and then a \n\n at the 'reply-to' part...

Here, where you seem to be writing to the file called list.txt, why don't you have store the data all on one line?

Quote:
# Vi lagrer all informasjon som ble fylt ut i sjemaet inn i filen....
print LIST("Navn: $FORM{'navn'} | Alder: $FORM{'Alder'} | Epost: $FORM{'Email'} |\n");
print LIST("Antall PC'er: $FORM{'antall_pc'} | Prosessor: $FORM{'cpu'} | Ram: $FORM{'ram'} |\n");
print LIST("Operativsystem: $FORM{'operativsystem'} | Spill: $FORM{'jeg_vil_spille'} | Filmer: $FORM{'film'} |\n");
print LIST("Mat i cafe: $FORM{'mat_i_cafe'} | Utstyr: $FORM{'utstyr'} | Antivirus: $FORM{'antivirus'} |\n");
print LIST("Antall gang før: $FORM{'antall_gang_for'} | Dato sendt: $date\n\n");

Not sure if that will make a difference..but thats how I normally do it Tongue These are just a few of the errors I can see...I'm sure there are quite a few more...but I don't have time to look at the rest of it all...sorry Frown

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [perlman] Help with a perl script In reply to
Also, another afterthought...do you have access to telnet? If so, then try running it via that with the syntax check tag on. That may revela few syntax errors, and possibly reval why its not working.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] Help with a perl script In reply to
Hi Andy!
Thanks for the help.
You know your thing!!!
At the end you said that I should store all in one line.
Do you mean with a array(@)??
I'm not sure what you ment.
And I don't have access to telnet.
That's really lame.
It's a lousy server, but the only one I could find that supports CGI/Perl and php for free.
(And I get 25 mb!)
Thanks for taking time to help me.
I will chech the script to see if it works.
And sorry all the error and mistakes.
I'm really terrible at writing perl scripts.
Just hope I learn from my mistakes!

My commant is: No body is perfect!
(Especially not me!!)
Quote Reply
Re: [perlman] Help with a perl script In reply to
Hi again!
I tried my script and it diden't work.
First I got a error message about me EndHtml, but I changed it and now it doesen't work.
I think there is something wrong at the bottom.
Please help me!

Last edited by:

brewt: May 12, 2011, 12:18 PM
Quote Reply
Re: [Andy.] Help with a perl script In reply to
I thought Sendmail deamon could only take ASCII characters? Therefore the following line would throw an error, Andy?

$subject = "Påmelding til dataparty.";

- wil
Quote Reply
Re: [perlman] Help with a perl script In reply to
perlman

If you're using Carp::Fatalstobrowser - what is the error message that is displayed in the browser? Does it also quote a line number?

- wil
Quote Reply
Re: [Wil] Help with a perl script In reply to
In Reply To:
I thought Sendmail deamon could only take ASCII characters? Therefore the following line would throw an error, Andy?

$subject = "Påmelding til dataparty.";
I'm not sure...as I have never had to use non english characters.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
> >