You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Mornini <tm...@infomania.com> on 2001/10/24 12:01:25 UTC

Odd problem with sections

I'm having a problem with <Perl> sections that I'm pretty sure shows a 
bug
of some sort in the code that handles this. I've looked around a bit and
can't find any Perl that is responsible for generating the error show 
below,
so I figured asking the list was the best next step.

in httpd.conf:

1  <Perl>
2    $ErrorLog = "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
ERROR";
3  </Perl>

4  ErrorLog "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
ERROR"

Lines 1-3 and 4 should do the same thing. They don't. I was banging my 
head
against the wall with lines 1-3, so I took them out and added line 4, 
which
works properly. I don't use them simultaneously, but mutually 
exclusively.

When I use the <Perl> section (which I need to allow the path to
spread_from_stdin.pl to be dynamic at runtime) I receive this error:

[Wed Oct 24 09:52:25 2001] [error] <Perl>: ErrorLog takes one argument, 
The filename of the error log

I think that this is a bug in whatever code validates $ErrorLog. It seems
it doesn't know that ErrorLog can be piped into another program...

Either that, or I'm being really dumb and missing something obvious. :-)

Any help would be greatly appreciated.

from server-info:

Apache Server Information

Server Settings, mod_perl.c, mod_log_spread.c, mod_access.c, 
mod_rewrite.c, mod_info.c, mod_status.c, mod_mime.c, http_core.c

Re: Odd problem with sections

Posted by Tom Mornini <tm...@infomania.com>.
On Wednesday, October 24, 2001, at 07:25 PM, Carolyn Hicks wrote:

> On Wed, Oct 24, 2001 at 06:52:13PM -0700, Tom Mornini wrote:
>> I don't believe that single quotes -vs- double quotes would make a
>> difference. Both things end up a single scalar, and I seriously doubt
>> that Apache can tell the difference...
>
> well, I meant single *and* double quotes - so the value of $Errorlog
> is actually quoted itself, like it is in the non-perl-ified directive,
> because it contains a space.  This fixed the problem I was having with
> LogFormat.  But if it's working for you now, cool.

Oh! I see now... :-)

Thanks, that's very interesting. I completely misunderstood your first
response, sorry about that!

--
-- Tom Mornini
-- InfoMania Printing & Prepress


Re: Odd problem with sections

Posted by Carolyn Hicks <ca...@bannoy.net>.
On Wed, Oct 24, 2001 at 06:52:13PM -0700, Tom Mornini wrote:
> I don't believe that single quotes -vs- double quotes would make a
> difference. Both things end up a single scalar, and I seriously doubt
> that Apache can tell the difference...

well, I meant single *and* double quotes - so the value of $Errorlog
is actually quoted itself, like it is in the non-perl-ified directive,
because it contains a space.  This fixed the problem I was having with
LogFormat.  But if it's working for you now, cool.

-carolyn


Re: Odd problem with sections

Posted by Tom Mornini <tm...@infomania.com>.
On Wednesday, October 24, 2001, at 06:38 PM, Carolyn wrote:

> On Wed, Oct 24, 2001 at 03:01:25AM -0700, Tom Mornini wrote:
>> in httpd.conf:
>>
>> 1  <Perl>
>> 2    $ErrorLog = 
>> "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
>> ERROR";
>> 3  </Perl>
>>
>> 4  ErrorLog "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
>> ERROR"
>>
>> Lines 1-3 and 4 should do the same thing. They don't.
>
> I was having this exact problem yesterday, with CustomLog and 
> LogFormat. I
> think it's to do with quotes - try putting single quotes around your
> $ErrorLog value, so apache will still see it as a quoted string.

I too am setting CustomLog, and it takes two or three values. So I set
@CustomLog and everything is fine. I set LogFormat outside the <Perl>
section and have no need to make it dynamic, so I can't comment here.

I worked around this by removing the need for the extra argument for
the program I wanted to pipe to, the 'ERROR' in the above example.
I just wrapped spread_from_stdin.pl with a shell script, and everything
is fine, but I really do suspect that this is a bug.

I don't believe that single quotes -vs- double quotes would make a
difference. Both things end up a single scalar, and I seriously doubt
that Apache can tell the difference...

--
-- Tom Mornini
-- InfoMania Printing & Prepress


Re: Odd problem with sections

Posted by Carolyn <ca...@bannoy.net>.
On Wed, Oct 24, 2001 at 03:01:25AM -0700, Tom Mornini wrote:
> in httpd.conf:
> 
> 1  <Perl>
> 2    $ErrorLog = "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
> ERROR";
> 3  </Perl>
> 
> 4  ErrorLog "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
> ERROR"
> 
> Lines 1-3 and 4 should do the same thing. They don't. 

I was having this exact problem yesterday, with CustomLog and LogFormat. I
think it's to do with quotes - try putting single quotes around your
$ErrorLog value, so apache will still see it as a quoted string.

- carolyn


Re: Odd problem with sections

Posted by Tom Mornini <tm...@infomania.com>.
On Wednesday, October 24, 2001, at 11:38 AM, Scott Lanning wrote:

> On Wed, 24 Oct 2001, Tom Mornini wrote:
>> 1  <Perl>
>> 2    $ErrorLog = 
>> "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl ERROR";
>> 3  </Perl>
>>
>> 4  ErrorLog "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
>> ERROR"
> [snip]
>> When I use the <Perl> section (which I need to allow the path to
>> spread_from_stdin.pl to be dynamic at runtime) I receive this error:
>>
>> [Wed Oct 24 09:52:25 2001] [error] <Perl>: ErrorLog takes one argument,
>> The filename of the error log
>
> On line 4, you passed one argument delimited by quotation marks.
> On line 2, you passed two arguments:
>    1) |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
>    2) ERROR
> so it seems you need to escape the space between them somehow
> (I guess by a backslash, or put single quotes around the double
> quotes, but I didn't test it).

Yes, you're the second person to mention it, but you said it more 
clearly...

This will work...

$ErrorLog = q["|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
ERROR"];

or qq[] if you need interpolation. (which I do)

--
-- Tom Mornini
-- InfoMania Printing & Prepress


Re: Odd problem with sections

Posted by Scott Lanning <sl...@BUPHY.bu.edu>.
On Wed, 24 Oct 2001, Tom Mornini wrote:
>1  <Perl>
>2    $ErrorLog = "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl ERROR";
>3  </Perl>
>
>4  ErrorLog "|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl ERROR"
[snip]
>When I use the <Perl> section (which I need to allow the path to
>spread_from_stdin.pl to be dynamic at runtime) I receive this error:
>
>[Wed Oct 24 09:52:25 2001] [error] <Perl>: ErrorLog takes one argument,
>The filename of the error log

On line 4, you passed one argument delimited by quotation marks.
On line 2, you passed two arguments:
    1) |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
    2) ERROR
so it seems you need to escape the space between them somehow
(I guess by a backslash, or put single quotes around the double
quotes, but I didn't test it).