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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.