~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to src/modules/perl/modperl_perl_global.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Salomon
  • Date: 2005-08-12 01:40:38 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050812014038-gjigefs55pqx4qc8
Tags: 2.0.1-3
Grr.  Really include perl.conf file; it got lost due to diff not
wanting to add an empty file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2001-2004 The Apache Software Foundation
 
1
/* Copyright 2001-2005 The Apache Software Foundation
2
2
 *
3
3
 * Licensed under the Apache License, Version 2.0 (the "License");
4
4
 * you may not use this file except in compliance with the License.
15
15
 
16
16
#include "mod_perl.h"
17
17
 
18
 
static void modperl_perl_global_init(pTHX_ modperl_perl_globals_t *globals)
19
 
{
20
 
    globals->env.gv    = PL_envgv;
21
 
    globals->inc.gv    = PL_incgv;
22
 
    globals->defout.gv = PL_defoutgv;
23
 
    globals->rs.sv     = &PL_rs;
24
 
    globals->end.av    = &PL_endav;
25
 
    globals->end.key   = MP_MODGLOBAL_END;
26
 
}
27
 
 
28
18
/* XXX: PL_modglobal thingers might be useful elsewhere */
29
19
 
30
 
#define MP_MODGLOBAL_FETCH(gkey) \
31
 
hv_fetch_he(PL_modglobal, (char *)gkey->val, gkey->len, gkey->hash)
32
 
 
33
 
#define MP_MODGLOBAL_STORE_HV(gkey) \
34
 
(HV*)*hv_store(PL_modglobal, gkey->val, gkey->len, (SV*)newHV(), gkey->hash)
35
 
 
36
 
#define MP_MODGLOBAL_ENT(key) \
37
 
{key, "ModPerl::" key, MP_SSTRLEN("ModPerl::") + MP_SSTRLEN(key), 0}
 
20
#define MP_MODGLOBAL_ENT(key)                                           \
 
21
    {key, "ModPerl::" key, MP_SSTRLEN("ModPerl::") + MP_SSTRLEN(key), 0}
38
22
 
39
23
static modperl_modglobal_key_t MP_modglobal_keys[] = {
40
24
    MP_MODGLOBAL_ENT("END"),
 
25
    MP_MODGLOBAL_ENT("ANONSUB"),
41
26
    { NULL },
42
27
};
43
28
 
65
50
    return NULL;
66
51
}
67
52
 
 
53
static void modperl_perl_global_init(pTHX_ modperl_perl_globals_t *globals)
 
54
{
 
55
    globals->env.gv    = PL_envgv;
 
56
    globals->inc.gv    = PL_incgv;
 
57
    globals->defout.gv = PL_defoutgv;
 
58
    globals->rs.sv     = &PL_rs;
 
59
    globals->end.av    = &PL_endav;
 
60
    globals->end.key   = MP_MODGLOBAL_END;
 
61
}
 
62
 
68
63
/*
69
64
 * if (exists $PL_modglobal{$key}{$package}) {
70
65
 *      return $PL_modglobal{$key}{$package};
157
152
 
158
153
    MP_TRACE_g(MP_FUNC, "clear PL_modglobal %s::%s (has %d entries)",
159
154
               package, (char*)gkey->name, av ? 1+av_len(av) : 0);
160
 
    
 
155
 
161
156
    if (av) {
162
157
        av_clear(av);
163
158
    }
179
174
     * keeps the unshifted cv (e.g. END block) in its original av
180
175
     * (e.g. PL_endav)
181
176
     */
182
 
     
 
177
 
183
178
    mav = modperl_perl_global_avcv_fetch(aTHX_ gkey, package, packlen, FALSE);
184
 
    
 
179
 
185
180
    if (!mav) {
186
181
        MP_TRACE_g(MP_FUNC, "%s::%s is not going to PL_modglobal",
187
182
                   package, (char*)gkey->name);
191
186
 
192
187
    MP_TRACE_g(MP_FUNC, "%s::%s is going into PL_modglobal",
193
188
               package, (char*)gkey->name);
194
 
        
 
189
 
195
190
    sv = av_shift(av);
196
 
    
 
191
 
197
192
    /* push @{ $PL_modglobal{$key}{$package} }, $cv */
198
193
    av_store(mav, AvFILLp(mav)+1, sv);
199
194
 
200
195
    /* print scalar @{ $PL_modglobal{$key}{$package} } */
201
196
    MP_TRACE_g(MP_FUNC, "%s::%s av now has %d entries\n",
202
197
               package, (char*)gkey->name, 1+av_len(mav));
203
 
    
 
198
 
204
199
    return 1;
205
200
}
206
201
 
271
266
 
272
267
    hv_riter = HvRITER(ohv);    /* current root of iterator */
273
268
    hv_eiter = HvEITER(ohv);    /* current entry of iterator */
274
 
        
 
269
 
275
270
    hv_iterinit(ohv);
276
271
    while ((entry = hv_iternext(ohv))) {
277
272
        SV *sv = newSVsv(HeVAL(entry));