You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ke...@wdr.com on 2000/03/07 20:39:12 UTC

RE: Re: Problem using tied hashes, Perl Sections, virtual hosts and structu red directives at the same time!

Doug

I couldn't use the alternative syntax you describe, because in real 
life I am trying to do something akin to the following conf file 
fragment:
======================
foreach $vhost (qw(cheetah dust wire)) {
	eval "tie %vhost_$vhost, Tie::DxHash";
	$EVAL_ERROR and warn("That's torn it: $EVAL_ERROR!\n");
}

%vhost_cheetah =
(
 ServerName      => 'cheetah',
 ...
 RewriteRule     => "^/(index\.html)?\$             
${frameset_prefix_b}/infra/cheetah/docs/cheetah.html   [L,PT]",
 RewriteRule     => '^/cheetah_beta(.*)             
http://fogmouth:7002/infra/cheetah$1',
 RewriteCond     => '%{HTTP:Rewritten}              !yes',
 RewriteCond     => "\$1                            
\.(html?(#.+)?|text)\$",
 RewriteRule     => "^(/infra/cheetah/docs/.+)\$    
${frameset_prefix_w}\$1                                [L,PT]",
);

foreach $vhost (qw(cheetah dust wire)) {
	eval 'push @{$VirtualHost{$NameVirtualHost}}, \%vhost_' . $vhost;
	$EVAL_ERROR and warn("Who needs virtual hosts anyway: 
$EVAL_ERROR!\n");
}

</Perl>
=======================

However, your patch seems to work fine!  I am tempting fate slightly, 
as I need to roll the patch into our main Apache build, use it with 
my main conf file and make sure that all is well for a few days, but 
certainly I do not get the syntax error from  my test conf file 
anymore.

Many thanks for the extremely rapid fix.

Cheers

Kevin

-----Original Message-----
From: dougm 
Sent: 07 March 2000 00:29
To: Ruscoe, Kevin
Cc: dougm; modperl
Subject: Re: Problem using tied hashes, Perl Sections, virtual hosts 
and
structu red directives at the same time!


On Mon, 6 Mar 2000 Kevin.Ruscoe@wdr.com wrote:
> 
> <Perl>
> use Tie::Hash;
> my(%VH);
> tie %VH, Tie::StdHash;
> %VH = ( ServerName => 'ln16p1166swk', Location => { 
> '/infra/recruitment' => { Require => 'group management' } } );
> $VirtualHost{'1.2.3.4'} = \%VH;
> </Perl>

try the patch below.  this syntax works with or without it:

<Perl>
use Tie::Hash;
my(%VH);
tie %VH, Tie::StdHash;
%VH = ( '1.2.3.4' => {
    ServerName => 'ln16p1166swk', 
    Location => { 
        '/infra/recruitment' => { 
            Require => 'group management',
          },
   }} );
</Perl>

--- src/modules/perl/perl_config.c      2000/03/05 21:49:51     1.87
+++ src/modules/perl/perl_config.c      2000/03/07 00:31:38
@@ -1127,6 +1127,7 @@
     while ((tmpval = hv_iternextsv(hv, &tmpkey, &tmpklen))) { 
        char line[MAX_STRING_LEN]; 
        char *value = NULL;
+       if (SvMAGICAL(tmpval)) mg_get(tmpval);
        if(SvROK(tmpval)) {
            if(SvTYPE(SvRV(tmpval)) == SVt_PVAV) {
                perl_handle_command_av((AV*)SvRV(tmpval), 



This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.