szabgab / perlmaven.com

The source files of the Perl Maven articles
http://perlmaven.com/
68 stars 109 forks source link

500 errors #562

Open pjcs00 opened 2 years ago

pjcs00 commented 2 years ago

Maybe it's too obvious to include, but my first response to a 500 error is:

perl -cw app.pl

Most of my scripts use $ENV{DOCUMENT_ROOT} or other environment variables, so this works better:

export DOCUMENT_ROOT=/path/to/website/root perl -cw app.pl

szabgab commented 2 years ago

Thanks for the suggestions. What kind of issues does this catch for you?

pjcs00 commented 2 years ago

Hi Gabor

I use 'perl -cw' to find anything that gets caught by the compiler - missing semicolons, mismatched brackets, undeclared variables, scope problems, missing 'use' or 'require' and so on. When making a small change to a working script it's tempting just to upload it (to a test instance of the site) and hope for the best, but a quick 'perl -cw' at least ensures that it will syntax check.

It's a lot easier and quicker reading the output from the Perl compile phase than deciphering the server log. My main hosting service has switched from Apache to Nginx, which has a much less readable log file.

It's also the case that warnings generated by a webpage don't always appear in the log file, and even if they do, you probably wouldn't notice them.

Peter

On Wed, 2 Mar 2022 at 04:19, Gabor Szabo @.***> wrote:

Thanks for the suggestions. What kind of issues does this catch for you?

— Reply to this email directly, view it on GitHub https://github.com/szabgab/perlmaven.com/issues/562#issuecomment-1056170126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVB6YDPXXFPYQW6PBVNHF5TU53T4HANCNFSM5PUDMXXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

-- ​Peter Campbell Smith @.*** 07599 992350 or 01372 728593