in reply to Errors in my (simple?) CGI Script!
Just some thoughts:
And finally: Ovids course
- $progid == "bush" should be $progid eq "bush"
- You need to untaint your variable $progid, follow the link to Ovids tutorial below for more info on CGI security.
- When you open the '$random_file' file you do not test whether it suceeded (see example)
- You have no else clause in your conditional block
- Try using use CGI::Carp qw(fatalsToBrowser); for debugging. See the CGI::Carp manpage for details.
- Use CGI to print your header. Don't do it manually.
- You redifine $/ but don't do it locally. Yes I know you are doing this to slurp files but you might find you aren't opening your other files properly (not knowing their content I couldn't say either way).
Or you could use $!:# Assuming is set in bush.conf unless(open(FILE,"<$random_file")) { # Handle it gracefully } my @lines = <FILE>; close(FILE);
Note that I have added a < to implicitly imply that I am opening the file. You might also want to consider the three argument form of open(). See the manpage for details.open(FILE,"<$random_file") || die "Could not open file",$!;
And finally: Ovids course
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Errors in my (simple?) CGI Script!
by shotgunefx (Parson) on Mar 09, 2002 at 21:46 UTC | |
by simon.proctor (Vicar) on Mar 09, 2002 at 22:22 UTC | |
by theguvnor (Chaplain) on Mar 10, 2002 at 01:19 UTC | |
by simon.proctor (Vicar) on Mar 10, 2002 at 16:11 UTC | |
| |
by Juerd (Abbot) on Mar 09, 2002 at 22:36 UTC | |
by rob_au (Abbot) on Mar 10, 2002 at 01:24 UTC | |
by no_slogan (Deacon) on Mar 10, 2002 at 02:24 UTC | |
by Juerd (Abbot) on Mar 10, 2002 at 09:33 UTC | |
by shotgunefx (Parson) on Mar 10, 2002 at 01:44 UTC | |
Re: Re: Errors in my (simple?) CGI Script!
by impossiblerobot (Deacon) on Mar 09, 2002 at 21:52 UTC | |
by gellyfish (Monsignor) on Mar 09, 2002 at 22:04 UTC | |
by Dog and Pony (Priest) on Mar 09, 2002 at 22:10 UTC |
In Section
Seekers of Perl Wisdom