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/TestDirective setupenv.pm
Date Mon, 19 Nov 2001 00:14:53 GMT
dougm       01/11/18 16:14:53

  Added:       t/directive setupenv.t
               t/response/TestDirective setupenv.pm
  Log:
  add test for PerlOptions +SetupEnv
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/directive/setupenv.t
  
  Index: setupenv.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  plan tests => 3;
  
  my $location = '/TestDirective::setupenv';
  
  my $env = GET_BODY $location;
  
  ok $env;
  print $env;
  my %env;
  
  for my $line (split /\n/, $env) {
      next unless $line =~ /=/;
      my($key, $val) = split /=/, $line, 2;
      $env{$key} = $val || '';
  }
  use Data::Dumper;
  print Dumper \%env;
  
  ok t_cmp $location, $env{REQUEST_URI}, "testing REQUEST_URI";
  
  ok not exists $env{HOME};
  
  
  
  1.1                  modperl-2.0/t/response/TestDirective/setupenv.pm
  
  Index: setupenv.pm
  ===================================================================
  package TestDirective::setupenv;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Const -compile => 'OK';
  
  sub handler {
      my $r = shift;
  
      $ENV{QS} = $r->args if $r->args;
  
      while (my($key, $val) = each %ENV) {
          next unless $key and $val;
          $r->puts("$key=$val\n");
      }
  
      Apache::OK;
  }
  
  1;
  __END__
  PerlOptions +SetupEnv
  
  
  
  

Mime
View raw message