Click to See Complete Forum and Search --> : PERL help PLEASE!


rbottner
08-25-2003, 10:55 AM
I am trying very hard to get this script working but I can't. The script is in go.pl which is below. The script originiates from www.richap.com/performance.htm (I know the graphics don't work right now) at the bottom of the page. The user types in a number and then is transferred to a page with that number.htm - I uploaded 023.htm to be used as a test page. When the user types in 023 in the field - they should be taken to www.richap.com/023.htm but instead I get a 500 server error. Please help me! Thanks!


THE TEXT IN GO.PL:
#!/usr/bin/perl
use CGI qw(header redirect param);
print redirect 'http://www.richap.com/'.(param 'number').'.htm';

Jeff Mott
08-25-2003, 01:31 PM
Are you certain you have the path to Perl correct? You can probably find that information in your host's documentation, or ask the administrator.

Also, make sure you are uploading this file as text (ASCII).

rbottner
08-25-2003, 01:49 PM
I copy that text into notebad and save as go.pl - I think thats what you mean by saving it as text and the administrator said that the path was correct.

Jeff Mott
08-25-2003, 02:05 PM
I copy that text into notebad and save as go.pl - I think thats what you mean by saving it as textWell... it does need to be saved as text, but it also needs to be uploaded as text. There is probably an option to upload as binary or text in the FTP program you used to copy your files to the hosting server.

rbottner
08-25-2003, 02:29 PM
I checked it once it was on the server - everything was fine. You don't think it's the code?

Charles
08-25-2003, 02:49 PM
It's unlikely that it's the code. To be certain make sure that they do have the CGI module installed and try running the following:

#!/usr/bin/perl
use CGI qw(header h4);
print header, h4('Hello, World!');

And I'm afraid that getting yor first Perl script to run is always a pain. The rest are easy, but the first is a pain.

Scriptage
08-30-2003, 06:38 PM
try...
is it uploaded to your cgi-bin?
are the file permissions 0755?

failing that...

#!/usr/bin/perl -w

use CGI qw(:all);
use strict;

my $file = param("number");
my $string = "http://www.richap.com/${file}.htm";
#optional: print header;
print redirect(-uri=>$string);

exit(0);