Several small problems are tripping you:
&loginpage if $loggedin = 0;You mean to compare with ==, not assign with = here. loginpage() will never be called because the assignment expression evaluates to 0, or false.
open (FILE, "users.dat");You're not checking to see if the open succeeds. Getting the permissions right on a data file can be tricky, so it's worth dying or warning if you can't open the file.
if (&checklogin($userdef, $passdef) == 0) {This is the second time you're calling this function. It's reasonable to assume you only need to call it once per invocation.
print header, start_html('Login Page'), hr;
This should be a comma. The rest of the HTML generating functions do nothing in void context and won't be printed to the screen.
if (param()) { $userdef = $query->param('user'); $passdef = $query->param('pass'); }
You're mixing the functional and object oriented interfaces to CGI here. Worse, I don't see where you've defined $query, so this is effectively useless.
If you turned on warnings with -w or the warnings module and enabled strict, Perl would let you know about most of these errors. Just run it from the command line:
perl -wc -Mdiagnostics mycgi.plYou'll have a lot of things to fix, but if you're having trouble debugging, you need all the information you can get. This is how to let Perl help you.
In reply to Re: Debugging hell!!
by chromatic
in thread Debugging hell!!
by toonski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |