On Sat, 22 Apr 2000, Eric Cholet wrote:

> mod_perl-2.0 requires perl 5.6 to be build with -Dusethreads, which turns
> on threading and multiplicity. 

just to be clear, as you mention below, -Dusetheads isn't required for
mod_perl-2.0, but strongly suggested if you use an mpm other than prefork :)
and i wouldn't say -Dusethreads "turns on threading", it simply makes the
Perl runtime re-entrant (as explained in an earlier message)

> The biggest hurdle I've faced until now is
> that DBI won't build with this threaded perl. Hopefully DBI will be updated
> since the latest version is from july 99.

it compiles with the patch below, not sure if it actually works though :)

> This is for using Apache 2.0's pthread MPM, of course you can build perl
> 5.6 non threaded and use apache 2.0's prefork model but then it's not
> as exciting :-)

maybe not as exciting, but still very important, the 1.3.x model works
quite well for many people, so mod_perl-2.0 will continue to support it.

--- DBI.xs~     Sun Jul 11 19:04:27 1999
+++ DBI.xs      Tue Apr 25 19:05:40 2000
@@ -9,6 +9,13 @@
 
 #include "DBIXS.h"     /* DBI public interface for DBD's written in C  */
 
+#ifndef pTHX_
+#define aTHXo_
+#define CopFILEGV(cop) cop->cop_filegv
+#define CopLINE(cop)   cop->cop_line
+#define get_sv perl_get_sv
+#endif
+
 #define MY_VERSION "DBI(" XS_VERSION ")"
 
 #if (defined USE_THREADS || defined PERL_CAPI || defined PERL_OBJECT)
@@ -112,7 +119,7 @@
 
 #   if (PATCHLEVEL == 4) && (SUBVERSION < 68)
 #     define dPERINTERP_SV                                     \
-        SV *perinterp_sv = perl_get_sv(MY_VERSION, FALSE)
+        SV *perinterp_sv = get_sv(MY_VERSION, FALSE)
 #   else
 #     define dPERINTERP_SV                                     \
         SV *perinterp_sv = *hv_fetch(PL_modglobal, MY_VERSION, \
@@ -121,7 +128,7 @@
 
 #   define dPERINTERP_PTR(T,name)                            \
     T name = (T)(perinterp_sv && SvIOK(perinterp_sv)         \
-                 ? SvIVX(perinterp_sv) : NULL)
+                 ? (T)SvIVX(perinterp_sv) : NULL)
 #   define dPERINTERP                                        \
     dPERINTERP_SV; dPERINTERP_PTR(PERINTERP_t *, PERINTERP)
 #   define INIT_PERINTERP \
@@ -189,13 +196,13 @@
     DBIS->size    = sizeof(*DBIS);
     DBIS->xs_version = DBIXS_VERSION;
     /* publish address of dbistate so dynaloaded DBD's can find it     */
-    sv_setiv(perl_get_sv(DBISTATE_PERLNAME,1), (IV)DBIS);
+    sv_setiv(get_sv(DBISTATE_PERLNAME,1), (IV)DBIS);
 
     DBISTATE_INIT; /* check DBD code to set DBIS from DBISTATE_PERLNAME        */
 
     DBIS->logfp        = stderr;
     DBIS->debug        = 0;
-    DBIS->neatsvpvlen = perl_get_sv("DBI::neat_maxlen", GV_ADDMULTI);
+    DBIS->neatsvpvlen = get_sv("DBI::neat_maxlen", GV_ADDMULTI);
     sv_setiv(DBIS->neatsvpvlen, 400);
     /* store some function pointers so DBD's can call our functions    */
     DBIS->getcom    = dbih_getcom;
@@ -613,7 +620,7 @@
     if (imp_size == 0) {
        /* get size of structure to allocate for common and imp specific data   */
        char *imp_size_name = mkvname(imp_stash, "imp_data_size", 0);
-       imp_size = SvIV(perl_get_sv(imp_size_name, 0x05));
+       imp_size = SvIV(get_sv(imp_size_name, 0x05));
        if (imp_size == 0)
            imp_size = g_imp_maxsize + 64;
     }
@@ -1450,16 +1457,16 @@
        fprintf(logfp," during global destruction.");
        return;
     }
-    if (!curcop->cop_line) {
+    if (!CopLINE(curcop)) {
        fprintf(logfp," at unknown location!");
        return;
     }
-    file = SvPV(GvSV(curcop->cop_filegv), len);
+    file = SvPV(GvSV(CopFILEGV(curcop)), len);
     if (trace_level<=4) {
        if ( (sep=strrchr(file,'/')) || (sep=strrchr(file,'\\')))
            file = sep+1;
     }
-    fprintf(logfp," at %s line %ld.", file, (long)curcop->cop_line);
+    fprintf(logfp," at %s line %ld.", file, (long)CopLINE(curcop));
 }
 
 
@@ -1751,7 +1758,7 @@
             */
            I32 markix = TOPMARK;
            CV *xscv   = GvCV(imp_msv);
-           (void)(*CvXSUB(xscv))(xscv);        /* Call the C code directly */
+           (void)(*CvXSUB(xscv))(aTHXo_ xscv); /* Call the C code directly */
 
            if (gimme == G_SCALAR) {    /* Enforce sanity in scalar context */
                if (++markix != stack_sp - stack_base ) {
@@ -2130,7 +2137,7 @@
            Fflush(DBILOGFP);
        }
        DBIS->debug = level;
-       sv_setiv(perl_get_sv("DBI::dbi_debug",0x5), level);
+       sv_setiv(get_sv("DBI::dbi_debug",0x5), level);
     }
     }
     OUTPUT:
@@ -2226,7 +2233,7 @@
     }
     if (type == '$') { /* lookup scalar variable in implementors stash */
        char *vname = mkvname(DBIc_IMP_STASH(imp_xxh), meth, 0);
-       SV *vsv = perl_get_sv(vname, 1);
+       SV *vsv = get_sv(vname, 1);
        if (trace)
            fprintf(DBILOGFP,"    <- %s = %s\n", vname, neatsvpv(vsv,0));
        ST(0) = sv_mortalcopy(vsv);

Reply via email to