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!
In reply to Re^2: script running on linux but not windows -- File::Spec
by thadc
in thread script running on linux but not windows
by thadc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |