perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestModperl env.pm
Date Thu, 15 Nov 2001 03:03:22 GMT
dougm       01/11/14 19:03:22

  Added:       t/response/TestModperl env.pm
  Log:
  add test for tie of %ENV to r->subprocess_env
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/response/TestModperl/env.pm
  
  Index: env.pm
  ===================================================================
  package TestModperl::env;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::Const -compile => 'OK';
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 20;
  
      my $env = $r->subprocess_env;
  
      ok $ENV{MODPERL_EXTRA_PL}; #set in t/conf/modperl_extra.pl
      ok $ENV{MOD_PERL};
  
      $ENV{FOO} = 2;
      ok $ENV{FOO} == 2;
      ok $env->get('FOO') == 2;
  
      $ENV{FOO}++;
      ok $ENV{FOO} == 3;
      ok $env->get('FOO') == 3;
  
      $ENV{FOO} .= 6;
      ok $ENV{FOO} == 36;
      ok $env->get('FOO') == 36;
  
      delete $ENV{FOO};
      ok ! $ENV{FOO};
      ok ! $env->get('FOO');
  
      ok $ENV{SERVER_SOFTWARE};
      ok $env->get('SERVER_SOFTWARE');
  
      {
          local %ENV = (FOO => 1, BAR => 2);
  
          ok $ENV{FOO} == 1;
          ok $env->get('FOO') == 1;
  
          ok ! $ENV{SERVER_SOFTWARE};
          ok ! $env->get('SERVER_SOFTWARE');
      }
  
      ok ! $ENV{FOO};
      #ok ! $env->get('FOO');
      #XXX: keys in the original subprocess_env are restored
      #     but new ones added to the local %ENV are not removed
      #     after the local %ENV goes out of scope
      #skip "r->subprocess_env + local() doesnt fully work yet", 1;
      ok 1; #the skip() message is just annoying
  
      ok $ENV{SERVER_SOFTWARE};
      ok $env->get('SERVER_SOFTWARE');
  
      Apache::OK;
  }
  
  1;
  __END__
  SetHandler perl-script
  
  
  

Mime
View raw message