Hi,
I am having problem using Spreadsheet::WriteExcel with
fork:
in a simple test, I have to declare $workbook using our,
instead of
using my
our $workbook =
Spreadsheet::WriteExcel->new("test.xls");
##if I used my, the xls format is wrong when used combined
with fork
# Add a worksheet
my $worksheet = $workbook->add_worksheet('wks1');
# Add and define a format
my $format = $workbook->add_format(); # Add a format
$format->set_bold();
# Write a formatted and unformatted string, row and
column
notation.
my ($col , $row )= (0, 0);
$worksheet->write($row, $col, "Hi Excel!",
$format);
$worksheet->write(1, $col, "Hi
Excel!");
my $child_pid;
my ids;
my a
= ('parent') ;
open OUT, ">$0.out";
for (my $i=0; $i < 10; $i++) {
$child_pid = fork();
if (!defined $child_pid ) {
die "cannot fork: $!";
} elsif ($child_pid) {
push ids, $child_pid;
# I'm the parent
} else {
# I'm the child
sleep (int (rand (5)));
push a, "child$i";
for (my $n=0; $n<20; $n++) {
print OUT "child$it at$nn";
}
exit;
}
}
foreach ( ids) {
waitpid ($_,0);
}
print " an";
close OUT;
$workbook->close();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Spreadsheet::WriteExcel" group.
To post to this group, send email to
spreadsheet-writeexcel googlegroups.com
To unsubscribe from this group, send email to
spreadsheet-writeexcel-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/spreadsheet-writeexcel
?hl=en
-~----------~----~----~----~------~----~------~--~---
|