home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / PerlRun.pm < prev    next >
Encoding:
Perl POD Document  |  2004-09-17  |  4.1 KB  |  158 lines

  1. # Copyright 2001-2004 The Apache Software Foundation
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. #     http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #
  15. package ModPerl::PerlRun;
  16.  
  17. use strict;
  18. use warnings FATAL => 'all';
  19.  
  20. # we try to develop so we reload ourselves without die'ing on the warning
  21. no warnings qw(redefine); # XXX, this should go away in production!
  22.  
  23. our $VERSION = '1.99';
  24.  
  25. use base qw(ModPerl::RegistryCooker);
  26.  
  27. sub handler : method {
  28.     my $class = (@_ >= 2) ? shift : __PACKAGE__;
  29.     my $r = shift;
  30.     return $class->new($r)->default_handler();
  31. }
  32.  
  33. my $parent = 'ModPerl::RegistryCooker';
  34. # the following code:
  35. # - specifies package's behavior different from default of $parent class
  36. # - speeds things up by shortcutting @ISA search, so even if the
  37. #   default is used we still use the alias
  38. my %aliases = (
  39.     new             => 'new',
  40.     init            => 'init',
  41.     default_handler => 'default_handler',
  42.     run             => 'run',
  43.     can_compile     => 'can_compile',
  44.     make_namespace  => 'make_namespace',
  45.     namespace_root  => 'namespace_root',
  46.     namespace_from  => 'namespace_from_filename',
  47.     is_cached       => 'FALSE',
  48.     should_compile  => 'TRUE',
  49.     flush_namespace => 'flush_namespace_normal',
  50.     cache_table     => 'cache_table_common',
  51.     cache_it        => 'NOP',
  52.     read_script     => 'read_script',
  53.     rewrite_shebang => 'rewrite_shebang',
  54.     get_script_name => 'get_script_name',
  55.     chdir_file      => 'chdir_file_normal',
  56.     get_mark_line   => 'get_mark_line',
  57.     compile         => 'compile',
  58.     error_check     => 'error_check',
  59.     should_reset_inc_hash => 'TRUE',
  60.     strip_end_data_segment             => 'strip_end_data_segment',
  61.     convert_script_to_compiled_handler => 'convert_script_to_compiled_handler',
  62. );
  63.  
  64. # in this module, all the methods are inherited from the same parent
  65. # class, so we fixup aliases instead of using the source package in
  66. # first place.
  67. $aliases{$_} = $parent . "::" . $aliases{$_} for keys %aliases;
  68.  
  69. __PACKAGE__->install_aliases(\%aliases);
  70.  
  71.  
  72.  
  73.  
  74.  
  75. 1;
  76. __END__
  77.  
  78.  
  79. =head1 NAME
  80.  
  81. ModPerl::PerlRun - Run unaltered CGI scripts under mod_perl
  82.  
  83. =head1 Synopsis
  84.  
  85.   # httpd.conf
  86.   PerlModule ModPerl::PerlRun
  87.   Alias /perl-run/ /home/httpd/perl/
  88.   <Location /perl-run>
  89.       SetHandler perl-script
  90.       PerlResponseHandler ModPerl::PerlRun
  91.       PerlOptions +ParseHeaders
  92.       Options +ExecCGI
  93.   </Location>
  94.  
  95.  
  96. =head1 Description
  97.  
  98.  
  99.  
  100.  
  101. =head1 Special Blocks
  102.  
  103.  
  104. =head2 C<BEGIN> Blocks
  105.  
  106. When running under the C<ModPerl::PerlRun> handler C<BEGIN> blocks
  107. behave as follows:
  108.  
  109. =over
  110.  
  111. =item *
  112.  
  113. C<BEGIN> blocks defined in scripts running under the
  114. C<ModPerl::PerlRun> handler are executed on each and every request.
  115.  
  116. =item *
  117.  
  118. C<BEGIN> blocks defined in modules loaded from scripts running under
  119. C<ModPerl::PerlRun> (and which weren't already loaded prior to the
  120. request) are executed on each and every request only if those modules
  121. declare no package. If a package is declared C<BEGIN> blocks will be
  122. run only the first time each module is loaded, since those modules
  123. don't get reloaded on subsequent requests.
  124.  
  125. =back
  126.  
  127. See also L<C<BEGIN> blocks in mod_perl
  128. handlers|docs::2.0::user::coding::coding/C_BEGIN__Blocks>.
  129.  
  130.  
  131. =head2 C<CHECK> and C<INIT> Blocks
  132.  
  133. Same as normal L<mod_perl
  134. handlers|docs::2.0::user::coding::coding/C_CHECK__and_C_INIT__Blocks>.
  135.  
  136.  
  137.  
  138. =head2 C<END> Blocks
  139.  
  140. Same as
  141. C<L<ModPerl::Registry|docs::2.0::api::ModPerl::Registry/C_BEGIN__Blocks>>.
  142.  
  143.  
  144. =head1 Authors
  145.  
  146. Doug MacEachern
  147.  
  148. Stas Bekman
  149.  
  150.  
  151.  
  152. =head1 See Also
  153.  
  154. C<L<ModPerl::RegistryCooker|docs::2.0::api::ModPerl::RegistryCooker>>
  155. and C<L<ModPerl::Registry|docs::2.0::api::ModPerl::Registry>>.
  156.  
  157. =cut
  158.