in reply to How do I capture large output in a perl variable
This command (property) sometimes produces an output of size almost 0.5Mb to 1Mb for some values of <dataid>(I checked the size of the output by executing the "property" command on the web server CLI).my $var = `property <dataid>`; print "<td align="middle">$var</td>";
So, your plan is to up upwards of 1MB of data into a single "<td>" element in the html that you output? Okay, I guess.
Regarding the presence of XML-tagged stuff in the middle of a plain-text stream: are you trying to show that verbatim, making all the XML tags visible?
And regarding your testing of the "property" program on the command line: are you sure that all the data ouput from this program is text? (Could there be non-printing control characters or other non-text, binary content? If so, what sort of operating system are you using, and do you need to specify "binary mode" for reading the data?)
It might be better (or at least, easier to debug) with a pipeline open statement:
If you still have problems with that, you can switch to reading the "property" output line by line, and/or add some diagnostics, and/or move the data to the output HTML stream in smaller chunks.my $var; open( PROG, "property $dataid |" ); # binmode PROG; # might need to do this? { local $/; # set input rec. separator to undef $var = <PROG>; # slurp output from property } close PROG; $var =~ s/</</g; # make sure browsers don't see XML tags as tags # if there is binary data, there's more you'll need to do # to make it presentable to a browser...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I capture large output in a perl variable
by vsmurthy (Initiate) on Mar 23, 2005 at 16:09 UTC | |
by Anonymous Monk on Mar 30, 2005 at 14:35 UTC |