Manual Pages for UNIX Darwin command on man Apache2::Directive
MyWebUniversity

Manual Pages for UNIX Darwin command on man Apache2::Directive

apacheapmaocdhepemrold-1p0e1r.l1-~12U0:s1:e.mr1o~dC2o:pn:etmrrolid-b2up.te0er.dl2-:P2:e.dr0ol.c2sD::o::cdauopmcies:n::t:Aaaptpaiico:hn:eA2p:a:cDhier2e:c:tDiivree(c3t)ive(3)

NAME

Apache2::Directive - Perl API for manipulating the Apache configuration

tree SSyynnooppssiiss

use Apache2::Directive ();

my $tree = Apache2::Directive::conftree();

my $documentroot = $tree->lookup('DocumentRoot');

my $vhost = $tree->lookup('VirtualHost', 'localhost:8000');

my $servername = $vhost->{'ServerName'};

use Data::Dumper;

print Dumper $tree->ashash;

my $node = $tree;

while ($node) {

print $node->asstring;

#do something with $node

my $directive = $node->directive;

my $args = $node->args;

my $filename = $node->filename;

my $linenum = $node->linenum;

if (my $kid = $node->firstchild) {

$node = $kid;

}

elsif (my $next = $node->next) {

$node = $next;

} else {

if (my $parent = $node->parent) {

$node = $parent->next;

} else {

$node = undef;

} } } DDeessccrriippttiioonn

"Apache2::Directive" provides the Perl API for manipulating the Apache

configuration tree AAPPII

"Apache2::Directive" provides the following functions and/or methods:

""aarrggss"" Get the arguments for the current directive:

$args = $node->args();

obj: $node ( "Apache2::Directive object" )

ret: $args ( string )

Arguments are separated by a whitespace in the string. since: 2.0.00 For example, in httpd.conf:

PerlSwitches -M/opt/lib -M/usr/local/lib -wT

And later:

my $tree = Apache2::Directive::conftree();

my $node = $tree->lookup('PerlSwitches');

my $args = $node->args;

$args now contains the string "-M/opt/lib -M/usr/local/lib -wT"

""aasshhaasshh"" Get a hash representation of the configuration tree, in a format suitable for inclusion in sections.

$confighash = $conftree->ashash();

obj: $conftree ( "Apache2::Directive object" )

The config tree to stringify

ret: $confighash ( HASH reference )

since: 2.0.00 For example: in httpd.conf:

SetHandler perl-script

PerlHandler Test::Module
And later:

my $tree = Apache2::Directive::conftree();

my $node = $tree->lookup('Location', '/test/');

my $hash = $node->ashash;

$hash now is:

{

'SetHandler' => 'perl-script',

'PerlHandler' => 'Test::Module', } ""aassssttrriinngg"" Get a string representation of the configuration node, in httpd.conf format.

$string = $node->asstring();

obj: $node ( "Apache2::Directive object" )

The config tree to stringify

ret: $string ( string )

since: 2.0.00 For example: in httpd.conf:

SetHandler perl-script

PerlHandler Test::Module
And later:

my $tree = Apache2::Directive::conftree();

my $node = $tree->lookup('Location', '/test/');

my $string = $node->asstring;

$string is now:

SetHandler perl-script

PerlHandler Test::Module ""ccoonnffttrreeee"" Get the root of the configuration tree:

$conftree = Apache2::Directive::conftree();

obj: "Apache2::Directive" ( class name )

ret: $conftree ( "Apache2::Directive object" )

since: 2.0.00 ""ddiirreeccttiivvee""

Get the name of the directive in $node:

$name = $node->directive();

obj: $node ( "Apache2::Directive object" )

ret: $name ( string )

since: 2.0.00 ""ffiilleennaammee"" Get the filename the configuration node was created from:

$filename = $node->filename();

obj: $node ( "Apache2::Directive object" )

ret: $filename ( string )

since: 2.0.00 For example:

my $tree = Apache2::Directive::conftree();

my $node = $tree->lookup('VirtualHost', 'example.com');

my $filename = $node->filename;

$filename is now the full path to the httpd.conf that VirtualHost was

defined in. If the directive was added with "addconfig()", the filename will be the path to the httpd.conf that trigerred that Perl code. ""ffiirrssttcchhiilldd"" Get the first child node of this directive:

$childnode = $node->firstchild;

obj: $node ( "Apache2::Directive object" )

ret: $childnode ( "Apache2::Directive object" )

Returns the first child node of $node, "undef" if there is none

since: 2.0.00 ""lliinneennuumm"" Get the line number in a filename this node was created at:

$lineno = $node->linenum();

obj: $node ( "Apache2::Directive object" )

arg1: $lineno (integer)

since: 2.0.00 ""llooookkuupp"" Get the node(s) matching a certain value.

$node = $conftree->lookup($directive, $args);

@nodes = $conftree->lookup($directive, $args);

obj: $conftree ( "Apache2::Directive object" )

The config tree to stringify

arg1: $directive ( string )

The name of the directive to search for opt arg2: "args" ( string ) Optional args to the directive to filter for

ret: $string ( string / ARRAY of HASH refs )

In LIST context, it returns all matching nodes. In SCALAR context, it returns only the first matching node.

If called with only $directive value, this method returns all nodes

from that directive. For example:

@Alias = $conftree->lookup('Alias');

returns all nodes for "Alias" directives.

If called with an extra $args argument, it returns only nodes where

both the directive and the args matched. For example:

$VHost = $tree->lookup('VirtualHost', 'default:8000');

since: 2.0.00 ""nneexxtt"" Get the next directive node in the tree:

$nextnode = $node->next();

obj: $node ( "Apache2::Directive object" )

ret: $nextnode ( "Apache2::Directive object" )

Returns the next sibling of $node, "undef" if there is none

since: 2.0.00 ""ppaarreenntt"" Get the parent node of this directive:

$parentnode = $node->parent();

obj: $node ( "Apache2::Directive object" )

ret: "parentnode" ( "Apache2::Directive object" )

Returns the parent of $node, "undef" if this node is the root node

since: 2.0.00 SSeeee AAllssoo modperl 2.0 documentation. CCooppyyrriigghhtt modperl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. AAuutthhoorrss The modperl development team and numerous contributors.

perl va5p.a8c.h8emodperl-101.1~2::mod2p0e0r5l-120.-02.02::docs::api::Apache2::Directive(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™