Randy Kobes wrote:
On Wed, 15 Oct 2003, Steve Hay wrote:
Attached is a patch to stop this warning being printed every time I run "perl Makefile.PL ...":
Use of uninitialized value in concatenation (.) or string at lib/ModPerl/BuildOptions.pm line 107, <DATA> line 20.
- Steve
===================================================================== --- BuildOptions.pm.orig 2003-10-07 19:28:38.000000000 +0100 +++ BuildOptions.pm 2003-10-15 11:43:18.272019200 +0100 @@ -105,7 +105,7 @@
my $fh; my @files = map { $_ . 'makepl_args.mod_perl2' } - qw(./ ../ ./. ../.), "$ENV{HOME}/.";
why not check for exists $ENV{HOME}?
Sounds fine to me, given Randy's use of HOME. New patch attached.
+ qw(./ ../ ./. ../.), (Apache::Build::WIN32() ? () : "$ENV{HOME}/.");
unshift @files, $self->{MP_OPTIONS_FILE} if $self->{MP_OPTIONS_FILE};
for my $file (@files) { @@ -164,6 +164,8 @@
sub table { $Table ||= parse_table(\*DATA); + close DATA; + return $Table; }
close DATA? but we have never opened it. What if this handler is reused second time under the same perl, it'll find the DATA fh closed? are you sure that this is the right solution?
The DATA filehandle is open already. From the "perldata" manpage:
"The filehandle is left open pointing to the contents after __DATA__. It is the program's responsibility to close DATA when it is done reading from it"
As you see, \*DATA is passed to parse_table(), which reads from it. We're supposed to close it afterwards, otherwise any subsequent error messages often confusingly refer to the last line that was read from DATA, e.g. just closing DATA but leaving the use of the uninitialised $ENV{HOME} changes the error from
Use of uninitialized value in concatenation (.) or string at lib/ModPerl/BuildOptions.pm line 107, <DATA> line 20.
to
Use of uninitialized value in concatenation (.) or string at lib/ModPerl/BuildOptions.pm line 107.
As for the handler being re-used: Is this a handler at all? It never occurred to me that BuildOptions.pm would be getting used in a handler. I assumed it was only used in the build process, hence the error from it when running Makefile.PL.
- Steve
--- BuildOptions.pm.orig 2003-10-07 19:28:38.000000000 +0100
+++ BuildOptions.pm 2003-10-16 08:47:34.504223900 +0100
@@ -105,7 +105,7 @@
my $fh;
my @files = map { $_ . 'makepl_args.mod_perl2' }
- qw(./ ../ ./. ../.), "$ENV{HOME}/.";
+ qw(./ ../ ./. ../.), (exists $ENV{HOME} ? "$ENV{HOME}/." : ());
unshift @files, $self->{MP_OPTIONS_FILE} if $self->{MP_OPTIONS_FILE};
for my $file (@files) {
@@ -164,6 +164,8 @@
sub table {
$Table ||= parse_table(\*DATA);
+ close DATA;
+ return $Table;
}
1;--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
