gozer       2004/09/13 16:36:08

  Modified:    .        Changes
               lib/Apache compat.pm
               t/compat .cvsignore
  Added:       t/response/TestCompat apache_module.pm
  Log:
  Apache::Module top_module() and get_config() as class methods
  added to Apache::compat for backwards compatibility
  
  Revision  Changes    Path
  1.483     +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.482
  retrieving revision 1.483
  diff -u -r1.482 -r1.483
  --- Changes   13 Sep 2004 22:36:18 -0000      1.482
  +++ Changes   13 Sep 2004 23:36:08 -0000      1.483
  @@ -12,6 +12,9 @@
   
   =item 1.99_17-dev
   
  +Apache::Module top_module() and get_config() as class methods
  +added to Apache::compat for backwards compatibility [Gozer]
  +
   Apache::Module top_module() and get_config() changed from class
   methods to regular subroutines [Gozer]
   
  
  
  
  1.119     +24 -0     modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- compat.pm 26 Aug 2004 00:57:38 -0000      1.118
  +++ compat.pm 13 Sep 2004 23:36:08 -0000      1.119
  @@ -138,6 +138,30 @@
   }
   EOI
   
  +    'Apache::Module::top_module' => <<'EOI',
  +{
  +    require Apache::Module;
  +    my $orig_sub = *Apache::Module::top_module{CODE};
  +    *Apache::Module::top_module = sub {
  +        shift;
  +        $orig_sub->(@_);
  +    };
  +    $orig_sub;
  +}
  +EOI
  +
  +    'Apache::Module::get_config' => <<'EOI',
  +{
  +    require Apache::Module;
  +    my $orig_sub = *Apache::Module::get_config{CODE};
  +    *Apache::Module::get_config = sub {
  +        shift;
  +        $orig_sub->(@_);
  +    };
  +    $orig_sub;
  +}
  +EOI
  +
       'APR::URI::unparse' => <<'EOI',
   {
       require APR::URI;
  
  
  
  1.4       +1 -0      modperl-2.0/t/compat/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/compat/.cvsignore,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- .cvsignore        17 Dec 2003 19:59:47 -0000      1.3
  +++ .cvsignore        13 Sep 2004 23:36:08 -0000      1.4
  @@ -1,5 +1,6 @@
   apache.t
   apache_file.t
  +apache_module.t
   apache_table.t
   apache_util.t
   apache_uri.t
  
  
  
  1.1                  modperl-2.0/t/response/TestCompat/apache_module.pm
  
  Index: apache_module.pm
  ===================================================================
  package TestCompat::apache_module;
  
  # Apache::Module compat layer tests
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::TestUtil;
  use Apache::Test;
  
  use Apache::compat ();
  use Apache::Constants qw(OK);
  
  our @APACHE_MODULE_COMMANDS = (
      {
          name => 'TestCompatApacheModuleParms',
      },
  );
  
  sub TestCompatApacheModuleParms {
      my($self, $parms, $args) = @_;
      Apache::compat::override_mp2_api('Apache::Module::get_config');
      my $config = Apache::Module->get_config($self, $parms->server);
      Apache::compat::restore_mp2_api('Apache::Module::get_config');
      $config->{data} = $args;
  }
  
  sub handler : method {
      my($self, $r) = @_;
  
      plan $r, tests => 2;
       
      Apache::compat::override_mp2_api('Apache::Module::top_module');
      my $top_module = Apache::Module->top_module();
      Apache::compat::restore_mp2_api('Apache::Module::top_module');
      ok t_cmp (ref($top_module), 'Apache::Module');
  
      Apache::compat::override_mp2_api('Apache::Module::get_config');
      my $config = Apache::Module->get_config($self, $r->server);
      Apache::compat::restore_mp2_api('Apache::Module::get_config');
      ok t_cmp ($config->{data}, 'Test');
      
      OK;
  }
  
  1;
  __END__
  
  # APACHE_TEST_CONFIG_ORDER 950
  
  <Base>
  PerlLoadModule TestCompat::apache_module
  </Base>
  TestCompatApacheModuleParms "Test"
  
  
  

Reply via email to