Home  |  Linux  | Mysql  | PHP  | XML
From:John W. Krahn Date:Wed Dec  9 11:11:44 2009
Subject:Re: Showing errors with user input
Adam Jimerson wrote:
> I am working on a registration page and there for want it to show the 
> user errors it has found with their input.  I have two subroutines in 
> my code, the first one prints out the form, also takes an array with 
> error descriptions that is passed by the other subroutine.  The other 
> subroutine takes the user input and verifies it, any errors that it 
> finds it pushes into an array called @errors and passes that back to 
> the first subroutine.   The problem is it doesn't work right when I 
> run it from the command line this is what I get:
> 
> vendion@SEServer:~/public_html/AmeriVista> perl -cT register.cgi
> [Sun Dec  6 14:12:12 2009] register.cgi: Illegal character in 
> prototype for main::form_verify : @user at register.cgi line 43.

Line 43 is:

sub form_verify (@user) {

The error is because (@user) is not a valid prototype.  Just change that to:

sub form_verify {


> [Sun Dec  6 14:12:12 2009] register.cgi: Scalar found where operator 
> expected at register.cgi line 93, near "$user"
> [Sun Dec  6 14:12:12 2009] register.cgi:        (Missing semicolon on 
> previous line?)

You get this message because line 91 does not end with a semicolon like 
it is supposed to.

		eval {
			my $GoodMail = Email::Valid->address( -address => "$user[5]", 
-mxcheck => 1);
			return;
		}

Should be:

		eval {
			my $GoodMail = Email::Valid->address( -address => "$user[5]", 
-mxcheck => 1);
			return;
		};


> [Sun Dec  6 14:12:12 2009] register.cgi: main::form_verify() called 
> too early to check prototype at register.cgi line 36.

You get this message because you are using a subroutine with a prototype 
before you declare that subroutine and prototype.  Just remove the 
invalid prototype.  This is the same prototype that is giving you 
problems on line 43.




John
-- 
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway
Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next


Your recent visits
Re: PB + Subversion + Trac integration.
AW: exit status
Re: 1-line datafile, need data for another routine
Fwd: [PHP-DB] Storing images
Re: [PHP-DB] Storing images


  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants