I know I posted this patch a while ago, but I am looking thru a few patches
I have and I thought I might re-post this one along with the rest

This module allows one to do

Apache->dso_module('module_name.c') and it will be true only of the
module in question is present and has been loaded as DSO.

Used to be usefull to me when attempting to work around <Perl> directives
and mod_perl as DSO/not-DSO (now fixed).

But I figured it could be usefull to others.

-- 
+-----------------------------------------------+
| Philippe M. Chiasson  <[EMAIL PROTECTED]>        |
| SmartWorker http://www.smartworker.org        |
|     IM : gozerhbe  ICQ : gozer/18279998       |
|   64.8% computer corrupt according to         |
| http://www.freespeech.org/ljk/purity.html     |
+-----------------------------------------------+
You're much more likely to be knocked down by a snowball
than by an equivalent number of snowflakes. 
        -- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl 
Hacker!\n$/&&print||$$++&&redo}'
Index: src/modules/perl/Apache.xs
===================================================================
RCS file: /home/cvs/modperl-1/src/modules/perl/Apache.xs,v
retrieving revision 1.121
diff -u -U10 -b -B -I'$Id' -I'$Revision' -r1.121 Apache.xs
--- src/modules/perl/Apache.xs  2001/05/01 17:28:37     1.121
+++ src/modules/perl/Apache.xs  2001/05/02 16:15:58
@@ -476,20 +476,40 @@
 
     CODE:
     if((*(SvEND(name) - 2) == '.') && (*(SvEND(name) - 1) == 'c'))
         RETVAL = find_linked_module(SvPVX(name)) ? 1 : 0;
     else
         RETVAL = (sv && perl_module_is_loaded(SvPVX(name)));
 
     OUTPUT:
     RETVAL
 
+I32
+dso_module(sv,name)
+    SV *sv
+    SV *name
+
+    PREINIT:
+    module *mod;
+
+    CODE:
+    mod = find_linked_module(SvPVX(name));
+    if(name && mod) {
+        RETVAL = (mod->dynamic_load_handle) ? 1 : 0;
+    }
+    else {
+         XSRETURN_UNDEF;
+    }
+
+    OUTPUT:
+    RETVAL
+
 char *
 mod_perl_set_opmask(r, sv)
     Apache     r
     SV *sv
 
 void
 untaint(...)
 
     PREINIT:
     int i;

Reply via email to