User Tools

Site Tools


kurs:mod_perl

Installation

http.conf:

LoadModule perl_module                    /usr/lib/apache2/mod_perl.so
## PerlRequire /home//startup.pl

<Location /print_env1>
        SetHandler perl-script
        #PerlHandler Apache2::SOAP
        #PerlSetVar dispatch_to Data::Conveyor::App::SOAP
        PerlResponseHandler MyApache2::PrintEnv1
</Location>

 file:MyApache2/PrintEnv1.pm
  -----------------------
  package MyApache2::PrintEnv1;
  use strict;
  
  use Apache2::RequestRec (); # for $r->content_type
  use Apache2::RequestIO ();  # for print
  use Apache2::Const -compile => ':common';
  
  sub handler {
      my $r = shift;
  
      $r->content_type('text/plain');
      for (sort keys %ENV){
          print "$_ => $ENV{$_}\n";
      }
  
      return Apache2::Const::OK;
  }
  
  1;

http://perl.apache.org/docs/2.0/user/config/config.html#Enabling_mod_perl

Immer ein Template System verwenden!
kurs/mod_perl.txt · Last modified: 2014/09/10 21:22 (external edit)