[svn:mod_parrot] r541 - in mod_parrot/trunk: lib/ModParrot t/response/TestAPI

[email protected] Tue, 9 Dec 2008 12:18:08 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Tue Dec  9 12:18:07 2008
New Revision: 541

Added:
   mod_parrot/trunk/t/response/TestAPI/context.pir
Modified:
   mod_parrot/trunk/lib/ModParrot/Context.pir

Log:
add pool moethods to ModParrot;Context


Modified: mod_parrot/trunk/lib/ModParrot/Context.pir
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/Context.pir	(original)
+++ mod_parrot/trunk/lib/ModParrot/Context.pir	Tue Dec  9 12:18:07 2008
@@ -80,22 +80,62 @@
 
 =back
 
-=head1 TODO
-
-=over 4
+=item conf_pool
 
-=item server_rec
+=cut
 
-=item conn_rec
+.sub conf_pool :method
+    $P0 = get_root_global [ 'ModParrot'; 'NCI' ], 'conf_pool'
+    $P1 = new 'Hash'
+    $P1['apr_pool'] = $P0
+    $P2 = new [ 'ModParrot'; 'APR'; 'Pool' ], $P1
+    .return($P2)
+.end
 
-=item request_pool
+=item log_pool
 
-=item conf_pool
+=cut
 
-=item log_pool
+.sub log_pool :method
+    $P0 = get_root_global [ 'ModParrot'; 'NCI' ], 'log_pool'
+    $P1 = new 'Hash'
+    $P1['apr_pool'] = $P0
+    $P2 = new [ 'ModParrot'; 'APR'; 'Pool' ], $P1
+    .return($P2)
+.end
 
 =item temp_pool
 
+=cut
+
+.sub temp_pool :method
+    $P0 = get_root_global [ 'ModParrot'; 'NCI' ], 'temp_pool'
+    $P1 = new 'Hash'
+    $P1['apr_pool'] = $P0
+    $P2 = new [ 'ModParrot'; 'APR'; 'Pool' ], $P1
+    .return($P2)
+.end
+
+=item child_pool
+
+=cut
+
+.sub child_pool :method
+    $P0 = get_root_global [ 'ModParrot'; 'NCI' ], 'child_pool'
+    $P1 = new 'Hash'
+    $P1['apr_pool'] = $P0
+    $P2 = new [ 'ModParrot'; 'APR'; 'Pool' ], $P1
+    .return($P2)
+.end
+
+=head1 TODO
+
+=over 4
+
+=item server_rec
+
+=item conn_rec
+
 =back
 
 =head1 AUTHOR

Added: mod_parrot/trunk/t/response/TestAPI/context.pir
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/t/response/TestAPI/context.pir	Tue Dec  9 12:18:07 2008
@@ -0,0 +1,33 @@
+# $Id$
+
+.namespace [ 'TestAPI::context' ]
+
+.sub handler
+    .param pmc r
+    .local pmc ctx, ap_const
+    .local string results
+
+    ap_const = get_root_global [ 'ModParrot'; 'Apache'; 'Constants' ], 'table'
+
+    r.'puts'("1..2\n")
+
+  START_1:
+    ctx = new [ 'ModParrot'; 'Context' ]
+    $S0 = typeof ctx
+    if $S0 == "ModParrot;Context" goto OK_1
+    r.'puts'("not ")
+  OK_1:
+    r.'puts'("ok 1 - object\n")
+
+  START_2:
+    $P0 = ctx.'conf_pool'()
+    $S0 = typeof $P0
+    if $S0 == "ModParrot;APR;Pool" goto OK_2
+    r.'puts'("not ")
+  OK_2:
+    r.'puts'("ok 2 - conf_pool\n")
+
+    $I0 = ap_const['OK']
+    .return($I0)
+.end
+