Gossamer Forum
Home : General : Perl Programming :

Perl script

Quote Reply
Perl script
For a month ago a guy asked me to make a script for him.
I started it and was almost finish, but then I ran into some errors.
Before I fixed it the guy said he diden't need the script for the moment.
Now, he has contacted me again and wants me to finish the script.
I have it, but the errors are still there.
Since I haven't been working with the script(and perl) for a month, I am confused.
I don't know where the errors are.
If anyone could take a look at the script and tell me it would be great.
Some of the text is in norwegian, but the script is normal perl.
The script is for a computerparty.
The error I keep getting is

Software error:
Execution of dataparty.cgi aborted due to compilation errors.

I don't know what to do??
The script is a bit confusing so I hope you understand.
Please let me know if anyone know what the problem is!

- Kjetil

Last edited by:

brewt: May 12, 2011, 12:19 PM
Quote Reply
Re: [perlman] Perl script In reply to
Does it tell you which line the error is on?

Did you upload the script using ASCII transfer mode and made sure that you CHMODed the file to 755.

HTH.

- wil
Quote Reply
Re: [perlman] Perl script In reply to
And did you test it via telnet:

perl -w script.cgi
perl -c script.cgi

That would produce more detailed errors. Or how about looking at your Perl Error Logs?
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [perlman] Perl script In reply to
You should really use CGI.pm for form processing.

Also I notice you are using:

my($errmsg) = @_;

...you only need shift there.

Re the error: You have a missing right bracket for starters line 153
Quote Reply
Re: [RedRum] Perl script In reply to
Okey, let me resume.
I did upload in ASCII and chmoded 755. (I'm not stupid!!)
And my server does not have telnet acess.
And I don't want to use CGI.pm.
This is one of my first scripts and I don't want to "cheat" on them!
And that thing RedRum said:
Quote:
Also I notice you are using:

my($errmsg) = @_;

...you only need shift there.

Re the error: You have a missing right bracket for starters line 153
Can you describe it better??
Please!!

Quote Reply
Re: [perlman] Perl script In reply to
He means you can use;

my $errmsg = shift;


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] Perl script In reply to
You only need @_ when passing more than one argument to your error routine.

>>This is one of my first scripts and I don't want to "cheat" on them! <<

Cheating by using CGI.pm? .....I'd saying asking for us to fix your bugs is more of a cheat Cool

Last edited by:

RedRum: Jan 8, 2002, 10:50 AM
Quote Reply
Re: [RedRum] Perl script In reply to
I still get the same error!!
I'll give you the address.
http://www.ungdoms-start.f2s.com/cgi-bin/dataparty.cgi
There is the script.
Go there and the error will show up.
Don't know if that will help......

Quote Reply
Re: [perlman] Perl script In reply to
Did you do as suggested by Eliot and Wil and also check line 153?

Last edited by:

RedRum: Jan 8, 2002, 11:38 AM
Quote Reply
Re: [perlman] Perl script In reply to
Code:


[Tue Jan 8 14:36:38 2002] dataparty.cgi: Missing right curly or square bracket at dataparty.cgi line 153, at end of line
[Tue Jan 8 14:36:38 2002] dataparty.cgi: syntax error at dataparty.cgi line 153, at EOF
[Tue Jan 8 14:36:38 2002] dataparty.cgi: Execution of dataparty.cgi aborted due to compilation errors.


Looks like you forgot a curly brace somewhere. I did see an if statement that wasn't closed but didn't look at it close enough to see where it should have been closed.



Regards,

Charlie
Quote Reply
Re: [perlman] Perl script In reply to
Hi "perlman"

I wasn't implying that you were stupid - just trying to catch a very common error.

BTW: Using modules is *not* cheating. It's the most clever thing you could do with your time and effort.

Hmm, weird Apache setup.

Cheers


- wil
Quote Reply
Re: Perl script In reply to
OK folks!
I got it going!
I had to remove the two if codes:
Code:

if ($FORM{'plasser'} = '@plass') {
dienice('Sorry, but the place you picked has alredy been chosen.<br> Go back and try another one. <a href=javascript:(1)back>Click here!</a>');
}

if ($FORM{'navn'} = '@dataparty') {
dienice('Somebody with the same name has you have alredy signed on. Write in a new name.');
}


Ok here's the deal.
The thing I wanted was that if the place has been picked by another one it would come up an error.
I tried to do it with a array, but that diden't work out.
What can I do???
I also want to check their name and see if the have signed in earlier.
How can do that??
Anyone have a clue??

And that cheat thing.
Okey, you can say that I cheat if I ask you, but asking is important to learn things and I don't want to use that CGI.pm thing.
Don't know why.
Just don't like the idea to use a huge script that somebody else has written. It takes the fun out of it.
(If you are a newbie!)
Quote Reply
Re: [perlman] Perl script In reply to
>>I tried to do it with a array, but that diden't work out. <<

Are you referring to:

if ($FORM{'plasser'} = '@plass') {

??

If so then surrounding @plass with ' ' is changing the way perl interprets it. You'd need:

my $plasser = $FORM{plasser};

if (grep { /^\Q$plasser\E$/ } @plass) {

error()

}
Quote Reply
Re: [RedRum] Perl script In reply to
Ok. I tried what you wrote RedRum, but it diden't work.
I'll post the script so you can see.
I sorry for asking you all the questions.
It's wrong of me to bother people to help me with a script that I should have made.
But I'll hope you'll help me cause I want this script to work.
Hope you have some ideas for me.
And if you see the code everybody gets a id and I want it to stop at 30. How can I do that??
I have tried something, but when I came to 30 you still could post.
I don't know whats wrong....
Quote Reply
Re: [perlman] Perl script In reply to
The grep code does work...its likely that your code isn't working in a way to allow it to work...I was only guessing based on your sample code.

Last edited by:

RedRum: Jan 9, 2002, 10:49 AM