Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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); }

In reply to having problem in displaying large size of variable on web page by perlCrazy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-29 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found