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

EXEC_ON_READ configuration block directives

Expand Messages
  • Dorian Taylor
    is there a working example of a block directive implementation available? i just tried setting one up the way
    Message 1 of 2 , Jun 18, 2005
    • 0 Attachment
      is there a working example of a block directive implementation
      available? i just tried setting one up the way
      http://perl.apache.org/docs/2.0/user/config/custom.html#C_Apache2__Const__RAW_ARGS_
      says, and i'm not appearing to get my config subroutine run.

      the config parser doesn't complain about the directive, but the
      hook doesn't seem to get run.

      i did the following:

      package Apache2::TestBlock;

      use strict;
      use warnings FATAL => 'all';

      use Apache2::Module ();
      use Apache2::Directive ();

      use Apache2::Const -compile => qw(TAKE1 RAW_ARGS OR_ALL EXEC_ON_READ);

      my @directives = (
      {
      name => '<TestBlock',
      func => __PACKAGE__ . '::TestBlock',
      args_how => Apache2::Const::RAW_ARGS,
      req_override => Apache2::Const::OR_ALL | Apache2::Const::EXEC_ON_READ
      },
      {
      name => 'TestScalar',
      func => __PACKAGE__ . '::TestScalar',
      args_how => Apache2::Const::TAKE1,
      req_override => Apache2::Const::OR_ALL,
      },
      );

      Apache2::Module::add(__PACKAGE__, \@directives);

      sub TestBlock {
      my ($self, $parms, $args) = @_;
      warn "wtf TestBlock dude";
      require Data::Dumper;
      warn Data::Dumper->Dump($parms->directive->as_hash);
      }

      sub TestScalar {
      my ($self, $parms, $arg) = @_;
      warn "TestScalar: $arg";
      }

      1;

      the config is this:

      PerlLoadModule Apache2::TestBlock

      <TestBlock foo>
      TestScalar bar
      </TestBlock>


      am i missing anything?

      .d
    • Philippe M. Chiasson
      ... I suspect something funny is going on with EXEC_ON_READ. I ve been able to reproduce your problem and I ll investigate some more. In the meantime, if it
      Message 2 of 2 , Jun 19, 2005
      • 0 Attachment
        Dorian Taylor wrote:
        > is there a working example of a block directive implementation
        > available? i just tried setting one up the way
        > http://perl.apache.org/docs/2.0/user/config/custom.html#C_Apache2__Const__RAW_ARGS_
        > says, and i'm not appearing to get my config subroutine run.

        I suspect something funny is going on with EXEC_ON_READ. I've been able to
        reproduce your problem and I'll investigate some more. In the meantime, if
        it works for you, you can simply run your code without the EXEC_ON_READ
        option. Works as expected/documented.

        > the config parser doesn't complain about the directive, but the
        > hook doesn't seem to get run.

        I suspect it's a problem with EXEC_ON_READ triggering code execution
        too soon. It is strange that nothing happens though, at least an error
        would be nice. I'll take a look at this.

        $mp-2.0/repos> fgrep EXEC_ON_READ t/ | egrep -v '^#'

        Oh, guess you just found a feature that was never tested ;-)

        --
        Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
        http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
      Your message has been successfully submitted and would be delivered to recipients shortly.