I read the previous messege of the problem with perl in threading i am using Active perl version 5.8.8 Build 817 and with it the threading version 1.3 i am using win32::ole module also to work with the excel sheets
In my programe i am using four threads which are independent( made them to detach) they start gives me output and then i start geting following errors
Attempt to free non-existent shared string 'Selection', Perl interpreter: 0x25a6ba4 during global destruction
Attempt to free non-existent shared string 'Workbooks', Perl interpreter: 0x25a6ba4 during global destruction
Attempt to free unreferenced scalar: SV 0x23bd058, Perl interpreter: 0x58baebc during global destruction
Win32::OLE(0.1707): GetOleObject() Not a Win32::OLE object during global destruction
Attempt to free non-existent shared string 'Worksheets', Perl interpreter: 0x5b650dc during global destruction.
Free to wrong pool 5b636a0 not 15d26e8 during global destruction.
Thread 8 terminated abnormally: Undefined subroutine &Carp::shortmess_heavy called at c:/Perl1/lib/Carp.pm line 258
Can any 1 please help in in this regard i am attaching the snipet of code dealing with thread as
for ($j=1; $j<=$col1; $j++) {
for ($i=1; $i<=$row1; $i++) {
if ($ram1->Cells($i,$j)->{Value} =~ /^.*$table[$z].*$/) {
print "$i\t$j...\n";
$sheet = $ram1;
my $thread1 = threads->new( &table11,$i,$j,$k,$l,$sheet,$ram1);
$retval1 = $thread1->detach();
print"Going in table11 thread\n";
#table11 ($i,$j,$k,$l,$sheet);
last;
}
}
}
sub req {
$a = $_[0];
$b = $_[1];
$c = $_[2];
$d = $_[3];
$sheet = $_[4];
$a1 = $a+2;
$b1 = $b;
$c1 = $c+2;
$d1 = $d+1;
print "req $c1\t$d1\n";
if ($sheet->Cells(($a+1),$b)->{Value} =~ /^.*US.*$/) {
while ($sheet->Cells($a1,$b1)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d1)->{Value} = $sheet->Cells($a1++,$b1)->{Value};
}
}elsif ($sheet->Cells(($a+1),$b)->{Value} =~ /^.*DS.*$/) {
while ($sheet->Cells($a1,$b1)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d1+1)->{Value} = $sheet->Cells($a1++,$b1)->{Value};
}
}
}
sub table11 {
# local $i,$j,$k,$l,$sheet;
# $a = i;
# local$b = $j;
# $c = $k;
# $d = $l;
# $sheet = $sheet;
# local $a = $_[0];
# local $b = $_[1];
# local $c = $_[2];
# local $d = $_[3];
# local $sheet = $_[4];
$a = $_[0];
$b = $_[1];
$c = $_[2];
$d = $_[3];
$sheet = $_[4];
print "table11 $c\t$d\n";
# For copying the loop lengths
$a1 = $a+2;
$c1 = $c+2;
while ($sheet->Cells($a1,$b)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d)->{Value} = $sheet->Cells($a1++,$b)->{Value};
}
# For copying the required data rates...
$b1 = $b;
while ($sheet->Cells($a,$b1)->{Value} !~ /^\s*$/) {
if (($sheet->Cells($a,$b1)->{Value} =~ /^.*Req.*$/) && ($sheet == $ram1)) {
my $thread2 = threads->new( \&req,$a,$b1,$c,$d,$sheet);
$retval2 = $thread2->detach();
#$retval = $thread1->eval; # catch join errors
}
elsif ($sheet->Cells($a,$b1)->{Value} =~ /^.*Act.*$/) {
my $thread3 = threads->new( \&act ,$a,$b1,$c,$d,$sheet);
$retva3 = $thread3->detach; # catch join errors
#act ($a,$b1,$c,$d,$sheet);
} elsif ($sheet->Cells($a,$b1)->{Value} =~ /^.*Mrg.*$/) {
my $thread4 = threads->new( \&mrg ,$a,$b1,$c,$d,$sheet);
$retva3 = $thread4->detach(); # catch join errors
#mrg ($a,$b1,$c,$d,$sheet);
}
$b1++;
}
$ram1 -> Activate;
$ram1 -> Cells(2,1) -> Select;
$ram2 -> Activate;
$ram2 -> Cells(2,1) -> Select;
$ram3 -> Activate;
$ram3 -> Cells(2,1) -> Select;
# Output file path...
$fille11 ="test_danube";
$oldfirm = "Amz";
$comp = $file11."-".$oldfirm.".xls";
$workbook3->SaveAs($comp);
$workbook3->Close;
$workbook->Save;
$workbook->Close;
$workbook1->Save;
$workbook1->Close;
$workbook2->Save;
$workbook2->Close;
$application->Quit(); # leave excel
undef $application;
undef $workbook1;
undef $workbook,
undef $workbook2;
undef $workbook3;
print "\nAnnex-A NA Comparison finished.....\n";
}
sub mrg {
$a = $_[0];
$b = $_[1];
$c = $_[2];
$d = $_[3];
$sheet = $_[4];
$a1 = $a+2;
$b1 = $b;
$c1 = $c+2;
$d1 = $d+9;
if ($sheet == $ram2) {
$d1++;
}
print "mrg $c1\t$d1\n";
if ($sheet->Cells(($a+1),$b)->{Value} =~ /^.*US.*$/) {
while ($sheet->Cells($a1,$b1)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d1)->{Value} = $sheet->Cells($a1++,$b1)->{Value};
}
} elsif ($sheet->Cells(($a+1),$b)->{Value} =~ /^.*DS.*$/) {
while ($sheet->Cells($a1,$b1)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d1+3)->{Value} = $sheet->Cells($a1++,$b1)->{Value};
}
}
}
# For the actual data rate fields
sub act {
$a = $_[0];
$b = $_[1];
$c = $_[2];
$d = $_[3];
$sheet = $_[4];
$a1 = $a+2;
$b1 = $b;
$c1 = $c+2;
$d1 = $d+3;
if ($sheet == $ram2) {
$d1++;
}
print "act $c1\t$d1\n";
if ($sheet->Cells(($a+1),$b)->{Value} =~ /^.*US.*$/) {
while ($sheet->Cells($a1,$b1)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d1)->{Value} = $sheet->Cells($a1++,$b1)->{Value};
}
} elsif ($sheet->Cells(($a+1),$b)->{Value} =~ /^.*DS.*$/) {
while ($sheet->Cells($a1,$b1)->{Value} !~ /^\s*$/) {
$ram3->Cells($c1++,$d1+3)->{Value} = $sheet->Cells($a1++,$b1)->{Value};
}
}
}
waiting for prompt reply
Regards
Imran Khalid