> We can't answer that with any certainty with the information provided.
> My *guess* is that you are confirming the correctness of the variable
> at some point in the code that is executed after the $logName
> assignment is made.
>
> Please post a short, but *complete*, program, that we can run by copy
> and pasting, which demonstrates your error.
>
> Paul Lalli
I fear posting an executable version of the script would contain several hundred lines of code, so that probably is out of the question. I can, however, try to provide you with as much information as possible.
The modules that are interesting for the problem are
1. Config.pm
2. Log4Logalizer.pm
Here is the entire Log4Logalizer.pm:
package Logalizer::Log4Logalizer;
use strict;
use warnings;
no warnings qw/ uninitialized /;
use Carp;
use Fcntl qw/

EFAULT :flock /;
use Logalizer::Config;
BEGIN {
use Exporter();
our ($VERSION, @ISA, @EXPORT);
$VERSION = 1.00;
@ISA = qw/ Exporter /;
@EXPORT = qw/ $verboseLevel &init &log /;
}
our $verboseLevel = 0;
our $logName = "$Logalizer::Config::logDirectory/logalizer.log";
our $LOG = \*LOG;
sub init {
unless (-d $Logalizer::Config::logDirectory) {
mkdir $Logalizer::Config::logDirectory, 0777
or croak "Can't mkdir $Logalizer::Config::logDirectory", ": $!";
}
# debug
carp "\$Logalizer::Config::logDirectory: ", "$Logalizer::Config::logDirectory\n";
carp "\$logName: $logName\n";
sysopen ($LOG, $logName, O_WRONLY | O_CREAT)
or croak "Can't open $logName: $!";
}
sub log {
my $message = shift;
my $verboseThreshold = shift || 0;
# try to open the file for writing and to get an exclusive lock
flock ($LOG, LOCK_EX | LOCK_NB) or croak "Can't lock $logName: $!";
if ($verboseThreshold >= $verboseLevel) {
print $LOG "$message\n";
}
}
1;
Here's how the global vars are declared in Config.pm:
#-----------------------------------------------------------------------# configuration variables, shared with other modules
#-----------------------------------------------------------------------our $scriptUrl;
our $outputDirectory;
our $outputUrl;
our $templateDirectory;
our $dataDirectory;
our $logfilePath;
our $backupLogfilePath;
our $baseUrl;
our $logDirectory; # for Log4Logalizer.pm
[...]
Config.pm has some subroutines to parse the configuration files. That works correctly, in fact everything is working correctly except the assignment in Log4Logalizer.pm.
Here are the error messages:
$Logalizer::Config::logDirectory: /srv/www/htdocs/logalizer
at /srv/www/cgi-bin/logalizer/src/logalizer.cgi line 83
$logName: /logalizer.log
at /srv/www/cgi-bin/logalizer/src/logalizer.cgi line 83
Can't open /logalizer.log: Permission denied at /srv/www/cgi-bin/logalizer/src/logalizer.cgi line 83
[Sat Jul 30 20:11:18 2005] [error] [client 127.0.0.1] Premature end of script headers: /srv/www/cgi-bin/logalizer/src/logalizer.cgi
I hope the code posted above is sufficient. I'd need to post the entire script to give you a more coherent image.
Thanks
SveTho