T
Ted Byers
Here is the simple loop with the problem:
print "\n\nProcessing merchant data: \n";
foreach $merchant(sort keys %merchants) {
print "\tmerchant name: $merchant\n\tmid: $merchants{$merchant}\n
\tAPI user name: $merchants_usernames{$merchant}\n\n";
system("activity.report.1.pl \"$merchant\" $merchants_usernames
{$merchant} $merchants{$merchant} $date_string 1>$dir\\activity.Report.
$merchant.stdout 2>$dir\\activity.Report.$merchant.stderr") == 0
or warn "Problem creating activity report for $merchant\n";
}
I am using "use strict" and $| = 1, from the top of the script.
The hash is fully populated and there are no null values in any
variable in the code shown.
The problem is that for 90% of the merchants, the script
activity.report.1.pl executes fine, producing the expected files
(those with the contents of stdout and stderr, as well as the desired
PDF file). For the rest, we get the merchant name, and the values
from the two hashes (that contain values to be provided as arguments
for the activity report script), followed by:
The process cannot access the file because it is being used by another
process.
Problem creating activity report for xxxxxxxxxxx xxxxxxx
The second line shown here is obviously from the die clause, but where
is the message "The process cannot access the file because it is being
used by another process." coming from? None of the information that
is written to stdout by the activity report script appears (e.g. the
first statement is to write to standard out the values of the
arguments), and nothing appears to be written to stderr either. The
files that ought to contain what is supposed to be written to stdout
and stderr don't even get created, hence my guess that the problem is
with the call to system.
Having previously printed out the contents of the hashes, I know the
correct arguments are being passed to "activity.report.1.pl" (from
comparing what was printed to the contents of the database table from
which the values are obtained, and what the activity report script
prints to standard out for the arguments it has received), and
activity.report.1.pl always runs to completion successfully when I
invoke it manually with all the same arguments that this script uses,
so I am at a loss. Why is my call to system failing (or how can I
find out), and what can be done to fix it? And why would it fail for
only 10% of the merchants?
Thanks
Ted
print "\n\nProcessing merchant data: \n";
foreach $merchant(sort keys %merchants) {
print "\tmerchant name: $merchant\n\tmid: $merchants{$merchant}\n
\tAPI user name: $merchants_usernames{$merchant}\n\n";
system("activity.report.1.pl \"$merchant\" $merchants_usernames
{$merchant} $merchants{$merchant} $date_string 1>$dir\\activity.Report.
$merchant.stdout 2>$dir\\activity.Report.$merchant.stderr") == 0
or warn "Problem creating activity report for $merchant\n";
}
I am using "use strict" and $| = 1, from the top of the script.
The hash is fully populated and there are no null values in any
variable in the code shown.
The problem is that for 90% of the merchants, the script
activity.report.1.pl executes fine, producing the expected files
(those with the contents of stdout and stderr, as well as the desired
PDF file). For the rest, we get the merchant name, and the values
from the two hashes (that contain values to be provided as arguments
for the activity report script), followed by:
The process cannot access the file because it is being used by another
process.
Problem creating activity report for xxxxxxxxxxx xxxxxxx
The second line shown here is obviously from the die clause, but where
is the message "The process cannot access the file because it is being
used by another process." coming from? None of the information that
is written to stdout by the activity report script appears (e.g. the
first statement is to write to standard out the values of the
arguments), and nothing appears to be written to stderr either. The
files that ought to contain what is supposed to be written to stdout
and stderr don't even get created, hence my guess that the problem is
with the call to system.
Having previously printed out the contents of the hashes, I know the
correct arguments are being passed to "activity.report.1.pl" (from
comparing what was printed to the contents of the database table from
which the values are obtained, and what the activity report script
prints to standard out for the arguments it has received), and
activity.report.1.pl always runs to completion successfully when I
invoke it manually with all the same arguments that this script uses,
so I am at a loss. Why is my call to system failing (or how can I
find out), and what can be done to fix it? And why would it fail for
only 10% of the merchants?
Thanks
Ted