Practical mod_perl / HTML Book /



previous page: 6.1.2. The strict Pragma
  
page up: HTML Version of the book
  
next page: 6.2. Exposing Apache::Registry Secrets

6.1.3. Enabling Warnings


It's also important to develop your code with Perl reporting every possible relevant warning. Under mod_perl, you can turn this mode on globally, just like you would by using the -w command-line switch to Perl. Add this directive to httpd.conf:

PerlWarn On

In Perl 5.6.0 and later, you can also enable warnings only for the scope of a file, by adding:

use warnings;

at the top of your code. You can turn them off in the same way as strict for certain blocks. See the warnings manpage for more information.

We will talk extensively about warnings in many sections of the book. Perl code written for mod_perl should run without generating any warnings with both the strict and warnings pragmas in effect (that is, with use strict and PerlWarn On or use warnings).

Warnings are almost always caused by errors in your code, but on some occasions you may get warnings for totally legitimate code. That's part of why they're warnings and not errors. In the unlikely event that your code really does reveal a spurious warning, it is possible to switch off the warning.

 

Continue to:

  • prev: 6.1.2. The strict Pragma
  • Table of Contents
  • next: 6.2. Exposing Apache::Registry Secrets







TOP
previous page: 6.1.2. The strict Pragma
  
page up: HTML Version of the book
  
next page: 6.2. Exposing Apache::Registry Secrets


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com