Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: CGI problem

by liverpole (Monsignor)
on Nov 06, 2011 at 14:36 UTC ( #936293=note: print w/ replies, xml ) Need Help??


in reply to CGI problem

    "...the '==' has to be used for numeric and 'eq' in case of strings."

Yes, '==' for numeric, 'eq' for strings, and '=' for assignments.

Years ago, I learned a good trick for avoiding this kind of error:

if ($query_str='') { ... }
when, in fact, you meant to say:
if ($query_str == '') { ... }

If you get in the habit of always putting the constant on the left side of the '==' sign:

if ('' == $query_str) { ... }
then, if you accidentally drop one of the '=', you'll get an error:
if ('' = $query_str) { ... } # Produces: # Can't modify constant item in scalar assignment at example.pl line + 3, # near "$query_str) " # Execution of example.pl aborted due to compilation errors.
I don't usually make the mistake of writing '=' where I meant '==', but whenever I do, thanks to putting the constant on the left side, the compiler now let's me know about it in no uncertain terms!

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/


Comment on Re: CGI problem
Select or Download Code
Re^2: CGI problem
by Anonymous Monk on Nov 06, 2011 at 21:49 UTC
      Hey Thank you for the timely help. But now i have another problem. My script seems to run fine from command line. but if it gets invoked by the apache server it throws internal server error. When i look into the error log this is what i get.
      [Mon Nov 07 14:59:57 2011] [error] [client 127.0.0.1] Premature end of + script headers: user_login.pl, referer: http://127.0.0.1/login.htm [Mon Nov 07 14:59:57 2011] [error] [client 127.0.0.1] install_driver(m +ysql) failed: Can't load 'C:/perl/perl/site/lib/auto/DBD/mysql/mysql. +dll' for module DBD::mysql: load_file:The specified module could not +be found at C:/perl/perl/lib/DynaLoader.pm line 200., referer: http:/ +/127.0.0.1/login.htm [Mon Nov 07 14:59:57 2011] [error] [client 127.0.0.1] at (eval 6) lin +e 3, referer: http://127.0.0.1/login.htm [Mon Nov 07 14:59:57 2011] [error] [client 127.0.0.1] Compilation fail +ed in require at (eval 6) line 3., referer: http://127.0.0.1/login.ht +m [Mon Nov 07 14:59:57 2011] [error] [client 127.0.0.1] Perhaps a requir +ed shared library or dll isn't installed where expected, referer: htt +p://127.0.0.1/login.htm [Mon Nov 07 14:59:57 2011] [error] [client 127.0.0.1] at C:/Program F +iles/Apache Software Foundation/Apache2.2/cgi-bin/user_login.pl line +57, referer: http://127.0.0.1/login.htm
      Any idea why could this happen What is Dynaloader.pm
        Can't load 'C:/perl/perl/site/lib/auto/DBD/mysql/mysql.dll'

        So:

        • Is DBD::mysql installed for the version of (mod_)Perl that Apache is running? You say the script works when you run it as another user, so make sure that both users see the same Perl and the same mod_perl.
        • Did it pass its test suite? If you installed the module via the CPAN tool, did it pass its test suite?
        • Is the file C:/perl/perl/site/lib/auto/DBD/mysql/mysql.dll there?
        • Does the Apache user have read/execute permissions for the file and all directories above it? You seem to be running Windows, so if the Apache user is running as a service, it may or may not have the appropriate permissions to load DLLs.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://936293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-07-22 11:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (111 votes), past polls