in reply to Re: script running on linux but not windows -- File::Spec
in thread script running on linux but not windows
Hello again and thank you for useful feedback. I am making very preliminary progress. I absolutely had to change some file paths up front for:
#set the log files
my $creationTime = strftime "%F-%R:%S", localtime;
$sqlLog = "C:/Users/thclotworthy/squirrel/logs/squirrel-sql-" . $creationTime . ".log";
$scriptLog = "C:/Users/thclotworthy/squirrel/logs/squirrel-" . $creationTime . ".log";
However, I am immediately getting error on the following line:
#Setup filehandlers for the mysql output log and the squirrel log
open($sqlFh, ">", $sqlLog) or exitOnError("Could not open $sqlLog for writing. Exiting......\n");
open($scriptFh, ">", $scriptLog) or exitOnError("Could not open $scriptLog for writing. Exiting......\n");
, where the exit on error is generated. Here is the exit on error subroutine:
sub exitOnError
{
my $errorString = $_[0];
print $sqlFh "$errorString\n";
print $scriptFh "$errorString\n";
print "$errorString\n";
exit(9);
}
, and here is the actual failure message on the terminal:
print() on closed filehandle $sqlFh at squirrelBAK.pl line 855. Can't use an undefined value as a symbol reference at squirrelBAK.pl line 856.
, So I am guessing that sqlFh perhaps needs to be initialized and I am not doing that?. The only instance of it before the code above is at the beginning of the script with other parameters:
my $dbHost; my $dbPort; my $serviceName; my @connectionNames; my %usernames; my %passwords; my $chosenRealm; my $release; my $releasePath; my $sqlLog; my $sqlFh; my $scriptLog; my $scriptFh;
, So perhaps I supposed to be passing it as a command line argument or something? Grateful for any ideas. Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: script running on linux but not windows -- File::Spec
by choroba (Cardinal) on Dec 20, 2017 at 17:00 UTC | |
|
Re^3: script running on linux but not windows -- File::Spec
by poj (Abbot) on Dec 20, 2017 at 17:55 UTC | |
|
Re^3: script running on linux but not windows -- File::Spec
by Marshall (Canon) on Dec 20, 2017 at 22:25 UTC | |
by choroba (Cardinal) on Dec 21, 2017 at 15:57 UTC |