Home  |  Linux  | Mysql  | PHP  | XML
From:Adam Jimerson Date:Tue Dec  8 03:34:14 2009
Subject:Re: Showing errors with user input
Greg Jetter wrote:

>
> You are trying to use a local scoped var as a global , line 93
$GoodMail
> is
> used out of its scope ,
>
> if ( $user[5] =~ /^([-\@\w.]+)$/ ) {
> $user[5] = $1;
> eval {
> my $GoodMail = Email::Valid->address( -address => "$user[5]", -
mxcheck =>
> 1);
> return;
> }
> #push @errors, "<p>Error: Double check your email address</p>" if
$@;
> $user[5] = $GoodMail;
> }
>
>
> it should read
>
> if ( $user[5] =~ /^([-\@\w.]+)$/ ) {
> my $GoodMail ;
> $user[5] = $1;
> eval {
> $GoodMail = Email::Valid->address( -address => "$user[5]", -mxcheck
=> 1);
> return;
> }
> #push @errors, "<p>Error: Double check your email address</p>" if
$@;
> $user[5] = $GoodMail;
> }
>
> or even declare it up with the other globals if you want , but the
way
> you
> have it now it is out of scope after that eval { } block completes.
>
>
> there may be other errors , fix that one first and try it again and
see
> what else pops up.
>
> have fun
>
> Greg

Ok I fixed that issue, can't even remember why I tried to declare it
in the eval block I guess that is what I get for writing code while
half asleep. The only other change that I made was I uncommitted out
the "push @errors, "<p>Error: Double check your email address</p>" if
$@;" line and here is the new error I get

[Mon Dec 7 22:24:30 2009] register.cgi: Illegal character in
prototype for main::form_verify : @user at register.cgi line 43.
[Mon Dec 7 22:24:30 2009] register.cgi: main::form_verify() called
too early to check prototype at register.cgi line 36.
Content-type: text/html

<h1>Software error:</h1>
<pre>syntax error at register.cgi line 93, near &quot;push&quot;
register.cgi had compilation errors.
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error
message
and the time and date of the error.

</p>
[Mon Dec 7 22:24:30 2009] register.cgi: syntax error at register.cgi
line 93, near "push"
[Mon Dec 7 22:24:30 2009] register.cgi: register.cgi had compilation
errors.

There is something about this push statement that Perl doesn't like,
the only thing I can think of is the if $@ part.

--
"We must plan for freedom, and not only for security, if for no other
reason than only freedom can make security more secure." Karl Popper
Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next


Your recent visits
Re: Storing a file from a cgi parameter
Re: content type headers
Need help with a login script
script working from shell, but not from browser.
Re: Showing errors with user input



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants