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

« back to all changes in this revision

Viewing changes to t/response/TestModperl/subenv.pm

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2004-08-19 06:23:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040819062348-jxl4koqbtvgm8v2t
Tags: 1.99.14-4
Remove the LFS CFLAGS, and build-dep against apache2-*-dev (>= 2.0.50-10)
as we're backing out of the apache2/apr ABI transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
use Apache::Const -compile => 'OK';
12
12
 
13
13
sub handler {
 
14
 
14
15
    my $r = shift;
15
16
 
16
 
    plan $r, tests => 16;
17
 
 
18
 
    my $env = $r->subprocess_env;
19
 
    ok $env;
20
 
 
21
 
    # subprocess_env in void context populates the same as +SetEnv
22
 
    ok_false($r, 'REMOTE_ADDR');
23
 
    $r->subprocess_env; 
24
 
    ok_true($r, 'REMOTE_ADDR');
25
 
 
26
 
    $env = $r->subprocess_env; #table may have been overlayed
27
 
 
28
 
    $env->set(FOO => 1);
29
 
    ok_true($r, 'FOO');
30
 
 
31
 
    $r->subprocess_env(FOO => undef);
32
 
    ok_false($r, 'FOO');
33
 
 
34
 
    $r->subprocess_env(FOO => 1);
35
 
    ok_true($r, 'FOO');
 
17
    plan $r, tests => 31;
 
18
 
 
19
    # subprocess_env in void context with arguments does
 
20
    # nothing to %ENV
 
21
    {
 
22
        my $env = $r->subprocess_env;
 
23
        
 
24
        my $key = 'ONCE';
 
25
 
 
26
        ok_false($r, $key);
 
27
 
 
28
        $r->subprocess_env($key => 1); # void context but with args
 
29
 
 
30
        ok_true($r, $key);
 
31
 
 
32
        ok ! $ENV{$key};               # %ENV not populated yet
 
33
    }
 
34
 
 
35
    # subprocess_env in void context with no arguments 
 
36
    # populates the same as +SetEnv
 
37
    {
 
38
        my $env = $r->subprocess_env;
 
39
 
 
40
        my $key = 'REMOTE_ADDR';
 
41
 
 
42
        ok_false($r, $key);   # still not not there yet
 
43
 
 
44
        ok ! $ENV{$key};      # %ENV not populated yet
 
45
 
 
46
        $r->subprocess_env;   # void context with no arguments
 
47
 
 
48
        ok_true($r, $key);
 
49
 
 
50
        ok $ENV{$key};        # mod_cgi emulation
 
51
    }
 
52
 
 
53
    # handlers can use a void context more than once to force
 
54
    # population of %ENV with new table entries
 
55
    {
 
56
        my $env = $r->subprocess_env;
 
57
 
 
58
        my $key = 'AGAIN';
 
59
 
 
60
        $env->set($key => 1);      # new table entry
 
61
 
 
62
        ok_true($r, $key);
 
63
 
 
64
        ok ! $ENV{$key};           # shouldn't affect %ENV yet
 
65
 
 
66
        $r->subprocess_env;        # now called in in void context twice
 
67
 
 
68
        ok $ENV{$key};             # so %ENV is populated with new entry
 
69
    }
 
70
 
 
71
    {
 
72
        my $env = $r->subprocess_env; # table may have been overlayed
 
73
 
 
74
        my $key = 'FOO';
 
75
 
 
76
        $env->set($key => 1);         # direct call to set()
 
77
 
 
78
        ok_true($r, $key);
 
79
 
 
80
        ok ! $ENV{$key};              # shouldn't affect %ENV
 
81
 
 
82
        $r->subprocess_env($key => undef);
 
83
 
 
84
        ok_false($r, $key);           # removed
 
85
 
 
86
        $r->subprocess_env($key => 1);
 
87
 
 
88
        ok_true($r, $key);            # reset
 
89
 
 
90
        ok ! $ENV{$key};              # still shouldn't affect %ENV
 
91
    }
36
92
 
37
93
    Apache::OK;
38
94
}