You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Markus Wichitill <ma...@gmx.de> on 2005/01/15 04:13:04 UTC

[PATCH] Show Apache and Perl environment in Apache::Status 2.x

Index: lib/Apache/Status.pm
===================================================================
--- lib/Apache/Status.pm	(revision 125243)
+++ lib/Apache/Status.pm	(working copy)
@@ -345,12 +345,12 @@
  sub status_env {
      my ($r) = shift;

+    # show perl environment
      my @retval = ("<p>\n");
-
      if ($r->handler eq 'modperl') {
          # the handler can be executed under the "modperl" handler
          push @retval,
-            qq{<b>Under the "modperl" handler, the environment is:</b>};
+            qq{<b>Under the "modperl" handler, the Perl %ENV is:</b>};
          # XXX: I guess we could call $r->subprocess_env; and show how
          # would it look like under the 'perl-script' environment, but
          # under the 'modperl' handler %ENV doesn't get reset,
@@ -359,13 +359,22 @@
      } else {
          # the handler can be executed under the "perl-script" handler
          push @retval,
-            qq{<b>Under the "perl-script" handler, the environment is</b>:};
+            qq{<b>Under the "perl-script" handler, the Perl %ENV is:</b>};
      }
      push @retval, "\n</p>\n";
      push @retval, "<pre>",
          (map "$_ = " . escape_html($ENV{$_}||'') . "\n",
              sort keys %ENV), "</pre>";

+    # show apache environment
+    my $ap_env = $r->subprocess_env();
+    push @retval, "\n<p>\n";
+    push @retval, qq{<b>The Apache subprocess_env is:</b>};
+    push @retval, "\n</p>\n";
+    push @retval, "<pre>",
+        (map "$_ = " . escape_html($ap_env->{$_}||'') . "\n",
+            sort keys %$ap_env), "</pre>";
+
      \@retval;
  }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [PATCH] Show Apache and Perl environment in Apache::Status 2.x

Posted by Markus Wichitill <ma...@gmx.de>.
Philippe M. Chiasson wrote:
> Patch didn't apply cleanly for me against latest subversion. 

Odd, it's against current SVN and your MUA even supports format=flowed to 
unwrap that one wrapped line.

>> +    # show perl environment
> This isn't needed.

Well, I like simple comments like that for navigational purposes, but if you 
prefer to keep diff lines to an absolute minimum, feel free to change it.

>> -            qq{<b>Under the "modperl" handler, the environment is:</b>};
>> +            qq{<b>Under the "modperl" handler, the Perl %ENV is:</b>};
> Why change the wording ?

To be more specific, since there's more than one environment. Which happens 
to be somewhat confusing for Apache newbies BTW.

>> -            qq{<b>Under the "perl-script" handler, the environment 
>> is</b>:};
>> +            qq{<b>Under the "perl-script" handler, the Perl %ENV 
>> is:</b>};
> Same question.

Also, the order of "<b>" and ":" was inconsistent before (I can nitpick, too ;)

>> +    push @retval, qq{<b>The Apache subprocess_env is:</b>};
> '<b>$r->subprocess_env is :</b>'

I like to call it the "Apache environment" and not just "subprocess 
environment", because it's used for more than just subprocesses. And 
sometimes it's interesting just to see e.g. the SSL vars, without even 
involving $r/mod_perl.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [PATCH] Show Apache and Perl environment in Apache::Status 2.x

Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Patch didn't apply cleanly for me against latest subversion.

A few nitpicks about your patch follows:

Markus Wichitill wrote:

> Index: lib/Apache/Status.pm
> ===================================================================
> --- lib/Apache/Status.pm    (revision 125243)
> +++ lib/Apache/Status.pm    (working copy)
> @@ -345,12 +345,12 @@
>  sub status_env {
>      my ($r) = shift;
>
> +    # show perl environment
>      my @retval = ("<p>\n");
> -

This isn't needed.

>      if ($r->handler eq 'modperl') {
>          # the handler can be executed under the "modperl" handler
>          push @retval,
> -            qq{<b>Under the "modperl" handler, the environment is:</b>};
> +            qq{<b>Under the "modperl" handler, the Perl %ENV is:</b>};

Why change the wording ?

>          # XXX: I guess we could call $r->subprocess_env; and show how
>          # would it look like under the 'perl-script' environment, but
>          # under the 'modperl' handler %ENV doesn't get reset,
> @@ -359,13 +359,22 @@
>      } else {
>          # the handler can be executed under the "perl-script" handler
>          push @retval,
> -            qq{<b>Under the "perl-script" handler, the environment 
> is</b>:};
> +            qq{<b>Under the "perl-script" handler, the Perl %ENV 
> is:</b>};
>      }

Same question.

>      push @retval, "\n</p>\n";
>      push @retval, "<pre>",
>          (map "$_ = " . escape_html($ENV{$_}||'') . "\n",
>              sort keys %ENV), "</pre>";
>
> +    # show apache environment
> +    my $ap_env = $r->subprocess_env();
> +    push @retval, "\n<p>\n";
> +    push @retval, qq{<b>The Apache subprocess_env is:</b>};

'<b>$r->subprocess_env is :</b>'

> +    push @retval, "\n</p>\n";
> +    push @retval, "<pre>",
> +        (map "$_ = " . escape_html($ap_env->{$_}||'') . "\n",
> +            sort keys %$ap_env), "</pre>";
> +
>      \@retval;
>  }

--------------------------------------------------------------------------------
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