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/hooks/TestHooks push_handlers_blessed.pm
Date Sat, 14 Feb 2004 23:22:07 GMT
stas        2004/02/14 15:22:07

  Modified:    src/modules/perl modperl_handler.c
               t/filter both_str_req_add.t
               t/hooks  .cvsignore push_handlers.t
  Added:       t/hooks/TestHooks push_handlers_blessed.pm
  Log:
  - B::Deparse >= 0.61 is only available since 5.8.x, but unless a code ref is
  blessed it'll work with older B::Deparse as well. Adjust the code to require 0.61
  only if the code ref is blessed. otherwise require 0.60.
  - add a blessed code ref test.
  
  Revision  Changes    Path
  1.24      +7 -4      modperl-2.0/src/modules/perl/modperl_handler.c
  
  Index: modperl_handler.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_handler.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -u -r1.23 -r1.24
  --- modperl_handler.c	14 Feb 2004 19:23:05 -0000	1.23
  +++ modperl_handler.c	14 Feb 2004 23:22:06 -0000	1.24
  @@ -8,12 +8,15 @@
       int count;
       SV *bdeparse;
       char *text;
  -
  -    /* B::Deparse >= 0.61 needed for blessed code references */
  -
  +    
  +    /* B::Deparse >= 0.61 needed for blessed code references.
  +     * 0.6 works fine for non-blessed code refs.
  +     * notice that B::Deparse is not CPAN-updatable.
  +     * 0.61 is available starting from 5.8.0
  +     */
       load_module(PERL_LOADMOD_NOIMPORT,
                   newSVpvn("B::Deparse", 10),
  -                newSVnv(0.61));
  +                newSVnv(SvOBJECT((SV*)cv) ? 0.61 : 0.60));
   
       ENTER;
       SAVETMPS;
  
  
  
  1.4       +1 -1      modperl-2.0/t/filter/both_str_req_add.t
  
  Index: both_str_req_add.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/filter/both_str_req_add.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- both_str_req_add.t	9 Feb 2004 19:32:42 -0000	1.3
  +++ both_str_req_add.t	14 Feb 2004 23:22:06 -0000	1.4
  @@ -5,7 +5,7 @@
   use Apache::TestRequest;
   use Apache::TestUtil;
   
  -plan tests => 1;
  +plan tests => 1, have_min_module_version('B::Deparse', 0.6);
   
   my $data = join ' ', 'A'..'Z', 0..9;
   my $expected = lc $data; # that's what the input filter does
  
  
  
  1.5       +2 -1      modperl-2.0/t/hooks/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/hooks/.cvsignore,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- .cvsignore	9 Feb 2004 19:08:35 -0000	1.4
  +++ .cvsignore	14 Feb 2004 23:22:07 -0000	1.5
  @@ -5,4 +5,5 @@
   fixup.t
   trans.t
   init.t
  -push_handlers_same_phase.t
  \ No newline at end of file
  +push_handlers_same_phase.t
  +push_handlers_blessed.t
  
  
  
  1.5       +1 -1      modperl-2.0/t/hooks/push_handlers.t
  
  Index: push_handlers.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/hooks/push_handlers.t,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- push_handlers.t	9 Feb 2004 19:32:43 -0000	1.4
  +++ push_handlers.t	14 Feb 2004 23:22:07 -0000	1.5
  @@ -5,7 +5,7 @@
   use Apache::TestUtil;
   use Apache::TestRequest;
   
  -plan tests => 1;
  +plan tests => 1, have_min_module_version('B::Deparse', 0.6);
   
   my @refs = qw(conf conf1 conf2 coderef 
                full_coderef coderef1 coderef2 coderef3);
  
  
  
  1.1                  modperl-2.0/t/hooks/TestHooks/push_handlers_blessed.pm
  
  Index: push_handlers_blessed.pm
  ===================================================================
  package TestHooks::push_handlers_blessed;
  
  # test that we
  # - can push and execute blessed anon handlers
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  use Apache::RequestUtil ();
  use APR::Table ();
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile => qw(OK DECLINED);
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 1, have_min_module_version('B::Deparse', 0.61);;
  
      my $sub = sub {
          ok 1;
  
          return Apache::OK;
      };
  
      my $handler = bless $sub, __PACKAGE__;
  
      $r->push_handlers(PerlResponseHandler => $handler);
  
      return Apache::DECLINED;
  }
  
  1;
  __DATA__
  <NoAutoConfig>
  <Location /TestHooks__push_handlers_blessed>
      SetHandler modperl
      PerlResponseHandler TestHooks::push_handlers_blessed
  </Location>
  </NoAutoConfig>
  
  
  

Mime
View raw message