Re: Flakey [Named]VirtualHost support, should TieHash be used?

2000-11-08 Thread Benjamin Trott

> For some reason I usually
> need to start Apache 4-5 times before it actually "sticks" and starts.

What do you mean by "sticks"? You mean, when it doesn't "work", Apache isn't
running?

What happens when you do httpd -S (should show the configured virtual
hosts)?

> One other weirdness.. when I startup Apache, I get a bunch of "unreferenced
> and undefined" warnings.  Those are evident in the ServerConfig.pm below.

You mean the @VirtualHost = ( undef, undef, ... ) stuff?

This is because of the following line:

> $VirtualHost{$ip}[++$#VirtualHost] = {

Where you write $#VirtualHost, that's the *array* @VirtualHost; it's not the
number of elements in @{ $VirtualHost{$ip} }. See the difference? Each time
you increment $#VirtualHost, you

It'd be possible to get the number of elements in @{ $VirtualHost{$ip} } and
increment that etc. But why not just use push?

push @{ $VirtualHost{$ip} }, { ... };

Much easier, yes?

Same thing here:

> $NameVirtualHost[++$#NameVirtualHost] = $ip;

push @NameVirtualHost, $ip;

bye,
Benjamin Trott




Re: Flakey [Named]VirtualHost support, should TieHash be used?

2000-11-08 Thread Alexey Zilber

 Benjamin Trott <[EMAIL PROTECTED]> 11/8/00 4:23:12 PM >>>
>> For some reason I usually
>> need to start Apache 4-5 times before it actually "sticks" and starts.
>
>What do you mean by "sticks"? You mean, when it doesn't "work", Apache isn't
running?

  Exactly.  It says httpd started but, form what I cant tell, it starts up really 
quickly, then exits.

> What happens when you do httpd -S (should show the configured virtual
> hosts)?

Show's everything correctly, but it also shows:
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.
Attempt to free unreferenced scalar.

Right before the VirtualHost configuration.   I just noticed that when it gives ~16 of 
those lines, apache won't start.  Less, it starts fine...

>> One other weirdness.. when I startup Apache, I get a bunch of "unreferenced
>> and undefined" warnings.  Those are evident in the ServerConfig.pm below.

> You mean the @VirtualHost = ( undef, undef, ... ) stuff?

Yes, that bothers me.

>This is because of the following line:
>
>> $VirtualHost{$ip}[++$#VirtualHost] = {
>
>Where you write $#VirtualHost, that's the *array* @VirtualHost; it's not the
>number of elements in @{ $VirtualHost{$ip} }. See the difference? Each time
>you increment $#VirtualHost, you

...  got cut off.. I increment the array not the elements??

>It'd be possible to get the number of elements in @{ $VirtualHost{$ip} } and
>increment that etc. But why not just use push?
>
>   push @{ $VirtualHost{$ip} }, { ... };
>
>Much easier, yes?
>
>Same thing here:
>
>> $NameVirtualHost[++$#NameVirtualHost] = $ip;
>
>push @NameVirtualHost, $ip;

Hmmm, something doesn't make sense here.  I originally used push, but the previous 
data got overwritten.  I'll try it again tonight and report back..

Thank you!


Alexey Zilber
Director of MIS
CCG.XM
498 Seventh Ave, 16th Fl
New York, New York, 10018
tel 212.297.7048
fax 212.297.8939
email [EMAIL PROTECTED]




Re: Flakey [Named]VirtualHost support, should TieHash be used?

2000-11-08 Thread Benjamin Trott

> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.

Interesting. Is the number of "Attempt to free unreferenced scalar."
messages the same as the number of undef elements in @VirtualHost?

>> Where you write $#VirtualHost, that's the *array* @VirtualHost; it's not the
>> number of elements in @{ $VirtualHost{$ip} }. See the difference? Each time
>> you increment $#VirtualHost, you
> 
> ...  got cut off.. I increment the array not the elements??

Oops, sorry. I was going to say that when you increment $#VirtualHost, you
increase the size of the array @VirtualHost, adding a new (undefined)
element.

In other words you're using an array as a glorified index counter. :)

bye,
Ben




Re: Flakey [Named]VirtualHost support, should TieHash be used?

2000-11-09 Thread Alexey Zilber

I'd just like to say that YOU ROCK!  I was using push the wrong way originally, by 
trying to push a hash unto an array.  This way works like a charm.  Got rid of the 
"Attempt to free unreferenced scalar." errors and the instability.

Thanks Ben!

Alex

Alexey Zilber
Director of MIS
CCG.XM
498 Seventh Ave, 16th Fl
New York, New York, 10018
tel 212.297.7048
fax 212.297.8939
email [EMAIL PROTECTED]

>>> Benjamin Trott <[EMAIL PROTECTED]> 11/8/00 5:25:32 PM >>>
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.
> Attempt to free unreferenced scalar.

Interesting. Is the number of "Attempt to free unreferenced scalar."
messages the same as the number of undef elements in @VirtualHost?

>> Where you write $#VirtualHost, that's the *array* @VirtualHost; it's not the
>> number of elements in @{ $VirtualHost{$ip} }. See the difference? Each time
>> you increment $#VirtualHost, you
> 
> ...  got cut off.. I increment the array not the elements??

Oops, sorry. I was going to say that when you increment $#VirtualHost, you
increase the size of the array @VirtualHost, adding a new (undefined)
element.

In other words you're using an array as a glorified index counter. :)

bye,
Ben