Be careful when you declare package names inside <Perl> sections. For example, this code has a problem:
<Perl> package Book::Trans; use Apache::Constants qw(:common); sub handler { OK } $PerlTransHandler = "Book::Trans"; </Perl>
When you put code inside a <Perl>section, by default it goes into the Apache::ReadConfig package, which is already declared for you. This means that the PerlTransHandler we tried to define will be ignored, since it's not a global variable in the Apache::ReadConfig package.
If you define a different package name within a <Perl>section, make sure to close the scope of that package and return to the Apache::ReadConfig package when you want to define the configuration directives. You can do this by either explicitly declaring the Apache::ReadConfig package:
<Perl> package Book::Trans; use Apache::Constants qw(:common); sub handler { OK } package Apache::ReadConfig; $PerlTransHandler = "Book::Trans"; </Perl>
or putting the code that resides in a different package into a block:
<Perl> { package Book::Trans; use Apache::Constants qw(:common); sub handler { OK } } $PerlTransHandler = "Book::Trans"; </Perl>
so that when the block is over, the Book::Trans package's scope is over, and you can use the configuration variables again.
However, it's probably a good idea to use <Perl>sections only to create or adjust configuration directives. If you need to run some other code not related to configuration, it might be better to place it in the startup file or in its own module. Your mileage may vary, of course.
 
Continue to: