[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] Can't MacPerl print more than 25.000 charw/out running out of memory?



>Hi All:
>
>First of all: I *don't* get an Out of Memory warning or anything like that.
>(I did read that posting and it didn't seem the same thing).
>
>I get some weird output with this little script (posted below). It is a copy
>of another one that runs fine, except the file that this one has to read has
>probably 40 more characters (no big deal) and what this one has to print is
>longer. Other than that, they're twin copies and the other one works ok.
>
>What I get for output from MacPerl  is weird: it starts from the *middle* of
>where it is supposed to, then prints the end and then from somewhere at the
>beginning to somewhere in between (!!!???). Weird, weird.
>
>Weirder: (1) if I make the print statement smaller, it works!
>                (2) If I use it to open the smaller file of its twin script,
>it doesn't.
>                (3) If run it from BBedit (with the $filename specified
>instead of the  '&StandardFile'GetFile') it works too!
>
>Conclusion (?): Does Run out of memory when it has to print something
>"large" ( 36.000 characters ?!?!?), or am I creating some kind of weird and
>hungry loop?
>
>I've increased MacPerl's memory partition. I've exported both scripts as
>droplets. The "small" one (print=20.000 char) works, the large one doesn't.
>I've increased the droplet's memory: nothing!
>
>What to do? Yell Help!
>
>Thank you
>
>Riccardo
>--
>mailto:perotti@pobox.com
>
>
>This is the "large" script.
>__________________________
>#!usr/bin/perl
>use strict
>require "StandardFile.pl";
>
>##Pick the File:
>$filename = &StandardFile'GetFile("TEXT");
>
>##Open & Read the file:
>open(INF,$filename) or die("I couldn't read the file!\n") ;
>chomp(@datos = <INF>);
>close(INF);
>
>$i = "a";
>foreach (@datos) {
>@{$i++} = split(/\t/,$_);
>}

#
# try this:
#
open (OUT, ">out.test") or die "Cannot open out-file: $!";
print OUT <<EOF;
>
>##NOTE: (here come 36.000 characters of HTML print with the variables set in
>the foreach loop)(As said above, if lowered to aprox 25.000, it works!).
>
>EOF

close(OUT); # close file

>
>print<<EOFooter;
><!--PERL SAYS: This Output is from $filename-->
>EOFooter
>__________________
>

Dear Riccardo,

there is a 32 KB barrier in both the MacPerl editor and the MacPerl
(STDOUT-) window due to the use (and inherent restrictions) of the TextEdit
Toolbox routines (you may know this from SimpleText). So if you try to
output more than 32 K characters, you will get the strange behaviour you've
described. As a workaround, you may want to print to a file (see my notes),
which works fine.

I hope, the next version of the MacPerl-App circumvents this restriction.

Best regards

--Thomas








==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org