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

Re: [mp2] Apache::PerlSections->dump gives no output at all.

Expand Messages
  • Philippe M. Chiasson
    ... The problem is now clear to me. The section handling in mod_perl 2, even though it s mostly backwards compatible with the way thing worked in 1.x,
    Message 1 of 4 , Nov 1, 2004
      M.v.Buytene wrote:
      > On 2004-10-28 17:34:23 +0200, "Philippe M. Chiasson"
      > <gozer@...> said:
      >>M.v.Buytene wrote:
      >>
      >> [...]
      >>>When i use the Apache::PerlSections->dump(); i only see
      >>>
      >>>1;
      >>>__END__
      >>

      The problem is now clear to me. The <Perl> section handling in mod_perl 2,
      even though it's mostly backwards compatible with the way thing worked in 1.x,
      is significantly different.

      This is a good example of it. The way processing of <Perl> sections is
      now done thru handlers, just like the rest of mod_perl. In this case, the call
      to Apache::PerlSections->dump() is performed at code evaluation time, _before_
      the PerlSection handler is handed the parsed <Perl> section. This will be
      documented shortly.

      But to fix your problem, the rule is simple. Put your code in <Perl> blocks and
      make sure to set $Apache::PerlSections::Save = 1. Then in *another* <Perl> block
      do your Apache::PerlSections->dump() call. So for instance:

      <Perl>
      $Apache::PerlSections::Save = 1;
      [...]
      </Perl>

      <Perl>
      print STDERR Apache::PerlSections->dump();
      </Perl>

      Or if you don't like the one-liner <Perl> block, you can also use the Perl directive
      for one-liners:

      Perl print STDERR Apache::PerlSections->dump();

      Either way, I'll be changing the documentation to make this clear.
      --
      --------------------------------------------------------------------------------
      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.