perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestDirective perlmodule.pm
Date Fri, 18 Jan 2002 06:52:01 GMT
stas        02/01/17 22:52:01

  Added:       t/directive perlmodule.t
               t/response/TestDirective perlmodule.pm
  Log:
  - add a test to test handling of PerlModule/Require directives for vhosts
  which inherit the interpretor from the parent. this time use the
  PerlModule directive for testing.
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/directive/perlmodule.t
  
  Index: perlmodule.t
  ===================================================================
  # this test tests PerlRequire configuration directive
  ########################################################################
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest;
  
  my $module = 'TestDirective::perlmodule';
  
  plan tests => 1;
  
  Apache::TestRequest::module($module);
  
  my $config   = Apache::Test::config();
  my $hostport = Apache::TestRequest::hostport($config);
  t_debug("connecting to $hostport");
  
  ok t_cmp($module,
           GET_BODY("/TestDirective::perlmodule"),
           "testing PerlModule in $module");
  
  
  
  
  1.1                  modperl-2.0/t/response/TestDirective/perlmodule.pm
  
  Index: perlmodule.pm
  ===================================================================
  package TestDirective::perlmodule;
  
  # This test is similar to TestDirective::perlrequire. Here we test
  # whether vhost inheriting the parent perl from the base can handle
  # PerlModule directives.
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test ();
  use Apache::Const -compile => 'OK';
  use File::Spec::Functions qw(catfile);
  
  sub handler {
      my $r = shift;
  
      $r->content_type('text/plain');
      $r->puts($ApacheTest::PerlModuleTest::MAGIC || '');
  
      Apache::OK;
  }
  
  sub APACHE_TEST_CONFIGURE {
      my ($class, $self) = @_;
  
      my $vars = $self->{vars};
      my $target_dir = catfile $vars->{documentroot}, 'testdirective';
  
      my $magic = __PACKAGE__;
      my $content = <<EOF;
  package ApacheTest::PerlModuleTest;
  \$ApacheTest::PerlModuleTest::MAGIC = '$magic';
  1;
  EOF
      my $file = catfile $target_dir, 'perlmodule-vh', 'ApacheTest', 'PerlModuleTest.pm';
      $self->writefile($file, $content, 1);
  }
  
  1;
  __END__
  <Base>
      PerlSwitches -Mlib=@documentroot@/testdirective/perlmodule-vh
  </Base>
  
  <VirtualHost TestDirective::perlmodule>
      PerlModule ApacheTest::PerlModuleTest
  
      <Location /TestDirective::perlmodule>
          SetHandler modperl
          PerlResponseHandler TestDirective::perlmodule
      </Location>
  
  </VirtualHost>
  
  
  

Mime
View raw message