A suggested new feature. Apache->dso_module('mod_example.c') behaves like Apache->module('mod_example.c') except it returns 1 if the module is loaded as DSO, 0 if it's compiled in and undef if it's not present at all. I wrote this because of a few problems I had with the 'slight' differences in behaviour of mod_perl under DSO and compiled in. In my case, I call an init function from a startup.pl, and because of the way apache starts then restarts, it gets called twice if mod_perl is compiled in and only once if it's a DSO. So I end up with code like this: sub init { return if($Apache::Server::Starting && not $Global::MOD_PERL_AS_DSO); } I guess it could be usefull for other purposes to, so here is the patch. -- +-----------------------------------------------+ | 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 | +-----------------------------------------------+ C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg. -- Bjarne Stroustrup 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.120 diff -u -U10 -b -B -I'$Id' -I'$Revision' -r1.120 Apache.xs --- src/modules/perl/Apache.xs 2001/04/17 21:57:20 1.120 +++ src/modules/perl/Apache.xs 2001/04/25 13:57:04 @@ -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;