[svn:mod_parrot] r331 - mod_parrot/trunk/lib/ModParrot/HLL
[email protected] Fri, 25 Jan 2008 11:27:13 -0800 (PST)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Fri Jan 25 11:27:12 2008
New Revision: 331
Modified:
mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir
Log:
add authentication handler to mod_perl6
Modified: mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir (original)
+++ mod_parrot/trunk/lib/ModParrot/HLL/perl6.pir Fri Jan 25 11:27:12 2008
@@ -117,3 +117,47 @@
# return status code
.return(status)
.end
+
+# authen handler
+.sub authen_handler
+ .param pmc ctx
+ .param string handler_name
+ .local string handler_sub
+ .local pmc handler
+ .local pmc r
+ .local pmc ap_const
+ .local int status
+
+ # get apache constants
+ ap_const = get_root_global [ 'Apache'; 'Constants' ], 'ap_constants'
+
+ # get the request_rec object
+ r = ctx.'request_rec'()
+
+ # set the default handler sub name
+ handler_sub = 'handler'
+
+ # load the handler
+ push_eh REPORT_ERROR
+ handler = load(handler_name)
+ pop_eh
+
+ # run the handler, passing in Apache::RequestRec object
+ push_eh REPORT_ERROR
+ status = handler(r)
+ pop_eh
+ goto RETURN_STATUS
+
+REPORT_ERROR:
+ get_results '0,0', $P0, $S0
+ $S1 = handler_name
+ concat $S1, ": "
+ concat $S1, $S0
+ $I0 = ap_const['APLOG_ERR']
+ r.'log_rerror'(handler_name, 0, $I0, $S1)
+ status = ap_const['HTTP_INTERNAL_SERVER_ERROR']
+
+RETURN_STATUS:
+ # return status code
+ .return(status)
+.end