Loading ...
Sorry, an error occurred while loading the content.
 

Re: Multiple Handlers

Expand Messages
  • Martin Moss
    It doesn t seem to work... This was the original solution I tried.. Here is the code:- if (Apache- can( set_handlers )) { print STDERR CAN PUSH HANDLERS
    Message 1 of 5 , Aug 31, 2005
      It doesn't seem to work... This was the original
      solution I tried..

      Here is the code:-

      if (Apache->can('set_handlers'))
      {
      print STDERR "CAN PUSH HANDLERS OK\n";
      }
      else
      {
      print STDERR "CANNOT PUSH HANDLERS OK\n";
      }
      my $list = $r->get_handlers( 'PerlHandler' );
      print STDERR "================================\n";
      print STDERR Dumper($$,$0,$list);
      print STDERR "===========================\n";
      $r->set_handlers( 'PerlHandler' =>
      ['My::Apache::User::Notification']);
      $r->handler('perl-script');
      my $list2 = Apache->get_handlers( 'PerlHandler' );
      print STDERR Dumper($$,$list,$list2);
      print STDERR "==========================\n";



      Here is the output I get in my logs:-

      CAN PUSH HANDLERS OK
      ==========================================================
      $VAR1 = 15253;
      $VAR2 = '/www/common/conf/core/traps.conf';
      $VAR3 = [
      'Embperl::handler'
      ];
      ==========================================================
      $VAR1 = 15253;
      $VAR2 = [
      'Embperl::handler'
      ];
      $VAR3 = [
      'III::Apache::User::Notification'
      ];
      ==========================================================

      ==========
      15253 Apache::AuthenDBI request type = main

      In Embperl::handler

      So as you can see, the set_handlers seems to work...
      But after the Authen stage has returned OK, the next
      handler to take control is Embperl::handler...

      Any Ideas?

      Regards

      Marty

      --- Geoffrey Young <geoff@...> wrote:

      >
      >
      > Martin Moss wrote:
      > > Have an awful suspicion the book I used suggested
      > > doing it the other way around? Would that make a
      > > difference?
      > >
      > > $r->handler('perl-script');
      > > $r->set_handlers(PerlHandler => [ My::Handler ]);
      >
      > none whatsoever.
      >
      > keep in mind that you can only call set_handlers()
      > during phases prior to
      > the phase you're setting. for example, you can't
      >
      > $r->set_handlers(PerlHandler => [ My::Handler ]
      >
      > from within a PerlHandler, but you could from within
      > a PerlAuthenHandler.
      >
      > btw, I saw that you wanted to unshift handlers (as
      > opposed to push). this is
      > how you do that
      >
      > my $handlers =
      > $r->get_handlers(`PerlFixupHandler');
      > $r->set_handlers(PerlFixupHandler => [`My::Bow',
      > @$handlers]);
      >
      > HTH
      >
      > --Geoff
      >






      ___________________________________________________________
      Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.