Hi gurus,
I have a problem printing values of DBI statement handle into a text file.
The detail problem is as bellows:
I am sending a query to one of the subroutines of a package and getting
the statement handle with return statement
If I print the values in statement handle on the STDOUT I am able to see
the values in it.
But If I print the same in a text file no values are written in the handle.
The file is getting created and no values are written into the file.
Please check the piece of code below:
_----------------------- SNIP
foreach my $CLASS_ID (keys %CLASS_ID_HASH)
{
foreach my $STR (@SEARCH_STRS_ARRAY)
{
foreach my $COL (@CLASS_SEARCH_COLS)
{
my $FILE = $COL . "_" . $STR . ".txt";
$FILE =~ s/\s+//g;
$FILE = "$BASE_RESULTS_FOLDER" . "//" . "$DIR_NAME"
. "//" . $FILE;
(open my $TEMP_FILE_HANDLE, '>', "$FILE") or die
"$!";
my $SQL="select class_id,title,description,tags from
$TABLE where $COL LIKE \'$STR\' AND class_id=\'$CLASS_ID\'";
my $results=$DB_CLASS_OBJ->RETRIVE_DATA($SQL);
(open my $FH, '>>', "$FILE") or die "$!";
while(my $row=$results->fetchrow_hashref())
{
print $FH
"class_id:$row->{class_id}\n";
print $FH "title:$row->{title}\n";
print $FH
"description:$row->{description}\n";
print $FH "tags:$row->{tags}\n";
}
close $FH;
}
}
}
_----------------------- SNIP
Thanks in Advance,
Siva
<<image001.gif>>
