http://www.perlmonks.org?node_id=641333

perlCrazy has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I am having problem in displaying large size of varaible on web page. Below is the Example:
$retHashRef{$viewItem[0]} = $viewStr;
Here in this example I am returning \%retHashRef to calling program. $viewStr is very big in size lets say 2 MB.
When I do print $viewStr, it does print. But when i am trying to print inside HTML like this it doesn't display anything:
foreach my $row (keys %$dbDDL) { push @rowArr, '<pre> ' . '<font size=2>' .$dbDDL->{$row} . '</font>' +. '</pre>' ; &P3::util::HTML::doTableDetailRow($altColor, @rowArr); }
Can somebody Please advice me why this is happening ? Thanks in advance.
Note : When I do just print $dbDDL->{$row}, it does print.
Update: Thanks for the response. And sorry for not being very clear in my post.
When I try to display small string it does display properly. This happens only when string size is very big.
Regarding P3::Util::HTML module, that is our own module and there is no problem in this.
Here is the code :
module name : Dbschema.pm this is portion of method that populate the hash for string. sub getViewProcs { my $lineNo=0; my $text; while (my $row = $sth->fetchrow_arrayref()) { ## Store + all columns value in array of hash #Add ownership information to views $text = $row->[0]; if ( !$lineNo ) { $text =~ s/^\s*create\s+view\s+$viewItem[0]\s+ +/create view $viewItem[1].$viewItem[0] /i; } $lineNo++; for (my $i=0;$i<length($text);$i+=100) { my $slice = substr($text, $i, 100); $viewStr .= $slice; } } } $retHashRef{$viewItem[0]} = $viewStr; } my ($procDDL) = $self->getViewProcs($dbase,'P'); if($procDDL){ foreach my $procStr (keys %$procDDL) { $pDDL .= "$procDDL->{$procStr}"; } $pDDL .= "$goTxt"; } $retHashRef{PROC} = $pDDL;
this is the code that does display on browswer.
This is the script that does take care of displaying og HTML my ($dbDDL) = $dbObj->getDbSchema($sourcedb,'%'); &P3::util::HTML::startTable("$sourcedb ",undef,undef,undef,un +def,$colexp); foreach my $row (keys %$dbDDL) { &P3::util::HTML::doTableColAttributes(''); # Reset the Co +lumn Attributes $altColor = !$altColor; my @rowArr; push @rowArr, '<pre> ' . '<font size=2>' .$dbDDL->{$row} +. '</font>' . '</pre>' ; &P3::util::HTML::doTableDetailRow($altColor, @rowArr); }