On Tue, Feb 11, 2003 at 10:01:07AM +1100, Stas Bekman wrote:
Joe Orton wrote:
Since rev 1.63 of TestConfigPerl.pm I get this error running TEST (after a fresh checkout)
make[1]: Leaving directory `/home/joe/src/httpd-test/pf/c-modules/authany'
!!! configure() has failed:
Use of uninitialized value in subroutine entry at /home/joe/src/httpd-test/pf/t/../Apache-Test/lib/Apache/TestConfigPerl.pm line 318, <GEN48> line 18.
backing down to r1.62 works fine. Any ideas? I'm using perl 5.8.0.
I can't reproduce it. The difference between 1.62 and 1.63 is a big refactoring of the code that parses the config sections.
Can you please check what is undefined? $line, $indent? Also a trace of calls that leads to this situation will help, which the following patch should accomplish:
I think I've tracked this down: parse_vhost() can return undef when it's passed a line like "<VirtualHost mod_nntp_like_ssl>" but parse_vhost_open_tag() assumes otherwise and barfs doing $cfg-> in the following lines.
Your example perfectly matches the regex in parse_vhost:
perl -le '$_ = "<VirtualHost mod_nntp_like_ssl>"; print $1||"", $2 if /^(\s*)<VirtualHost\s+(?:_default_:)?(.*?)\s*>\s*$/'
mod_nntp_like_ssl
or is it something else? I mean what causes the undef to be returned, that I was unable to reproduce with perl-framework tests?
This seems to fix it for me (and the config file produced doesn't cause httpd to barf), is this OK to checkin?
Otherwise it's certainly a good fix. thanks Joe!
Just a slight change before you commit: since the returned value is either a hash ref or undef, there is no need to check for defined $cfg, but just true/false $cfg. Also I'd write it the other way around:
--- Apache-Test/lib/Apache/TestConfigPerl.pm 3 Feb 2003 02:18:32 -0000 1.65
+++ Apache-Test/lib/Apache/TestConfigPerl.pm 19 Mar 2003 22:47:35 -0000
@@ -316,11 +316,15 @@
my($self, $line, $indent) = @_;
my $cfg = $self->parse_vhost($line); - my $port = $cfg->{port}; - $cfg->{out_postamble}->(); - $self->postamble("$indent<VirtualHost _default_:$port>"); - $cfg->{in_postamble}->(); - + if ($cfg) { + my $port = $cfg->{port}; + $cfg->{out_postamble}->(); + $self->postamble("$indent<VirtualHost _default_:$port>"); + $cfg->{in_postamble}->(); + } + else { + $self->postamble("$indent$line"); + } }
#the idea for each group:
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com