A simple problem befuddling my simple head 
Author Message
 A simple problem befuddling my simple head

Hello,

I am just learning PERL, and I am trying to set up a simple validation
script, it checks to set that the content of one edit box is the same
as another. Its similar to 'choose a password - now confirm it'. No
matter what I do I keep getting a 500 error.

So far I have :

==============

#!/bin/perl -w

use CGI;

$cgiobject = new CGI;

$email1=$cgiobject->param("email1");
$email2=$cgiobject->param("email2");

print $cgiobject->header;

test();

  sub test

  {

   If ($email1 eq $email2)
   {print "yes they match"}

   else
   {print "no they dont"}

  }

I have been prowling the archives of this group for most of the
afternoon, and have found several approaches, but cannot get any to
work. Can anyone suggest anyhting to help ? I have preinted out
contents of email1/email2 from the htm page so i know they are coming
through ok, and are identical, and that the path to PERL is correct.

Thanks for any help, sorry about the simplistic stupidity of the
question.

Liam



Sun, 07 Aug 2005 20:33:45 GMT  
 A simple problem befuddling my simple head

Quote:

> Hello,

> I am just learning PERL, and I am trying to set up a simple validation
> script, it checks to set that the content of one edit box is the same
> as another. Its similar to 'choose a password - now confirm it'. No
> matter what I do I keep getting a 500 error.

> So far I have :

> ==============

> #!/bin/perl -w

> use CGI;

> $cgiobject = new CGI;

> $email1=$cgiobject->param("email1");
> $email2=$cgiobject->param("email2");

> print $cgiobject->header;

> test();

>   sub test

>   {

>    If ($email1 eq $email2)
>    {print "yes they match"}

>    else
>    {print "no they dont"}

>   }

> I have been prowling the archives of this group for most of the
> afternoon, and have found several approaches, but cannot get any to
> work. Can anyone suggest anyhting to help ? I have preinted out
> contents of email1/email2 from the htm page so i know they are coming
> through ok, and are identical, and that the path to PERL is correct.

> Thanks for any help, sorry about the simplistic stupidity of the
> question.

> Liam

Is your 500 error from you web browser?  Try running perl -c scriptname on
the command line (-c will check that it compiles without trying to run
it)..  I cut'n'pasted this to a script and got a message telling the there
is a syntax error at line 19 near ")
{"

Try writing "if" instead of "If".

Graham



Sun, 07 Aug 2005 21:01:15 GMT  
 A simple problem befuddling my simple head

Quote:

> Is your 500 error from you web browser?

Web browsers do not generate that error.

Web servers do.

--
    Tad McClellan                          SGML consulting

    Fort Worth, Texas



Sun, 07 Aug 2005 22:33:51 GMT  
 A simple problem befuddling my simple head

Quote:

> $email1=$cgiobject->param("email1");
> $email2=$cgiobject->param("email2");

Actually, you can give them the same name;


Quote:
> print $cgiobject->header;

Let the web-server know what type of data it should expect;

  print $cgiobject->header( -type => 'text/html' );

Quote:
>    If ($email1 eq $email2)

Seems like a typo; Try 'if' instead of 'If'.

--



Mon, 08 Aug 2005 01:23:49 GMT  
 A simple problem befuddling my simple head

Quote:

> I am just learning PERL,

Did you mean 'Perl'?

Quote:
> and I am trying to set up a simple validation
> script, it checks to set that the content of one edit box is the same
> as another.

Perl does not have edit boxes.

Quote:
> Its similar to 'choose a password - now confirm it'. No
> matter what I do I keep getting a 500 error.

I' guessing this is a stealth CGI question.
In that case you should follow the advise given in the FAQ: perldoc -q 500

Quote:
> So far I have :
[...]
>    If ($email1 eq $email2)

Upper case 'If'? Maybe you meant 'if'?

If you would have tested your script from the command line then the perl
parser would have told you about this bug already and you would have never
had to guess about some obscure 500 error.

jue



Mon, 08 Aug 2005 03:35:36 GMT  
 A simple problem befuddling my simple head

Quote:
>Hello,

>I am just learning PERL, and I am trying to set up a simple validation
>script, it checks to set that the content of one edit box is the same
>as another. Its similar to 'choose a password - now confirm it'. No
>matter what I do I keep getting a 500 error.

Server 500 errors are almost always due to Perl compile-time errors. I wrote an
article for an online mag a long time ago:

http://perlmonth.com/perlmonth/issue11/begin.html

Quote:

>So far I have :

>==============

>#!/bin/perl -w

>use CGI;

>$cgiobject = new CGI;

>$email1=$cgiobject->param("email1");
>$email2=$cgiobject->param("email2");

>print $cgiobject->header;

>test();

>  sub test

>  {

>   If ($email1 eq $email2)

"If" is not "if".

Quote:
>   {print "yes they match"}

>   else
>   {print "no they dont"}

>  }

When in doubt, run your script from a command line like this:

$ perl -cw myscript.pl



Sun, 07 Aug 2005 21:11:08 GMT  
 A simple problem befuddling my simple head
On Thu, 20 Feb 2003 02:35:36 GMT, "Jrgen Exner"

Quote:

>I' guessing this is a stealth CGI question.

Considering that the third and fifth lines in the program
are:

use CGI;
and
$cgiobject = new CGI;

I wouldn't exactly say it was very stealthy.

Off-topic, yes.  Stealthy, no.
--
Regards, Helgi Briem
helgi AT decode DOT is



Mon, 08 Aug 2005 11:08:43 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. head function in Simple package fails to return all fields

2. help with simple regexp - does my head in

3. simple way to alter html head

4. XS - Simple answer to simple question?

5. Simple TCP client using io::socket::inet not so simple

6. simple, simple regex Q

7. Help with simple simple perl script...

8. Simple Question from a simple chap!

9. Simple Question - LWP::Simple not accessing the internet

10. simple, simple question

11. Simple Unix Question, ( Simple for you maybe )

12. Simple simple question

 

 
Powered by phpBB® Forum Software