perl.cvs.mod_parrot
[Top] [All Lists]

[svn:mod_parrot] r364 - in mod_parrot/trunk/lib: . Apache

Subject: [svn:mod_parrot] r364 - in mod_parrot/trunk/lib: . Apache
From: jhorwitz@xxxxxxxxxxxx
Date: Sun, 20 Jul 2008 07:41:03 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Sun Jul 20 07:41:03 2008
New Revision: 364

Added:
   mod_parrot/trunk/lib/Apache/Module.pir
Modified:
   mod_parrot/trunk/lib/mod_parrot.pir

Log:
move module code into Apache/Module.pir


Added: mod_parrot/trunk/lib/Apache/Module.pir
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/lib/Apache/Module.pir      Sun Jul 20 07:41:03 2008
@@ -0,0 +1,141 @@
+# $Id$
+
+# Copyright (c) 2008 Jeff Horwitz
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+=head1 NAME
+
+Apache/Module.pir
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=cut
+
+.namespace [ 'Apache'; 'Module' ]
+
+.sub _initialize :load
+    .local pmc module_class
+    .local pmc func
+    .local pmc nul
+
+    null nul
+
+    dlfunc func, nul, "mpnci_add_apache_module", "pJtP"
+    set_root_global [ '_modparrot'; 'NCI' ], "add_apache_module", func
+
+    newclass module_class, [ 'Apache'; 'Module' ]
+    addattribute module_class, 'module'
+.end
+
+=head2 FUNCTIONS
+
+=over 4
+
+=cut
+
+=item C<add(STRING name, ARRAY cmds)>
+
+=over 4
+
+Creates a new Apache module and adds its directives to Apache.  This must be
+called via ParrotLoadImmediate or another HLL-specific directive that causes
+an early interpreter startup.
+
+C<name> is the name of your module.  It should be unique.  HLLs should prepend
+mdoule names with the name of the HLL to avoid conflicts.  C<cmds> is an array
+of hashes.  Each element of the array defines a configuration directive.  The
+directive hash is defined as follows:
+
+=over 4
+
+C<name> - name of the directive
+
+C<args_how> - defines how arguments are parsed:
+
+=over 4
+
+C<NO_ARGS>
+
+C<TAKE1>
+
+C<TAKE2>
+
+C<TAKE3>
+
+C<TAKE12>
+
+C<TAKE23>
+
+C<TAKE123>
+
+C<RAW_ARGS>
+
+C<FLAG>
+
+=back
+
+C<func> - a subroutine PMC to be called when the directive is encountered.
+
+C<req_override> - the directive's configuration scope
+
+=over 4
+
+C<OR_NONE>
+
+C<OR_LIMIT>
+
+C<OR_OPTIONS>
+
+C<OR_FILEINFO>
+
+C<OR_AUTHCFG>
+
+C<OR_INDEXES>
+
+C<OR_UNSET>
+
+C<ACCESS_CONF>
+
+C<RSRC_CONF>
+
+C<OR_ALL>
+
+=back
+
+C<errmsg> -the directive's usage statement
+
+C<cmd_data> - a user-defined PMC to be passed back to the callback function.
+
+=back
+
+=back
+
+=cut
+
+.sub add
+    .param string name
+    .param pmc cmds
+    .local pmc add_module
+
+    add_module = get_root_global ['_modparrot'; 'NCI' ], "add_apache_module"
+    add_module(name, cmds)
+.end
+
+=head1 AUTHOR
+
+Jeff Horwitz
+
+=cut

Modified: mod_parrot/trunk/lib/mod_parrot.pir
==============================================================================
--- mod_parrot/trunk/lib/mod_parrot.pir (original)
+++ mod_parrot/trunk/lib/mod_parrot.pir Sun Jul 20 07:41:03 2008
@@ -57,9 +57,6 @@
     dlfunc func, nul, "mpnci_ap_log_rerror", "vJtiiipt"
     set_root_global [ '_modparrot'; 'NCI' ], "ap_log_rerror", func
 
-    dlfunc func, nul, "mpnci_add_apache_module", "pJtP"
-    set_root_global [ '_modparrot'; 'NCI' ], "add_apache_module", func
-
     dlfunc func, nul, "mpnci_conf_pool", "pJ"
     set_root_global [ '_modparrot'; 'NCI' ], "conf_pool", func
 

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r364 - in mod_parrot/trunk/lib: . Apache, jhorwitz <=