Hello Craig,

To quote Queen: "It's a kind of magic". ;-)

The tip with autoflush was spot on and resolved the issue entirely for my
use case.

I'll still give 5.14 a good spin when it comes out.

Thanks a lot for the help!

Greetings, Martin



|--------------------+---------------------------------------------------------------------------------------------------------------->
|"Craig A. Berry"    |                                                          
                                                      |
|<craigbe...@mac.com>|                                                          
                                                      |
|                    |                                                          
                                                    To|
|21.04.2011 17:40    |        "Dr. Martin P.J. Zinser" 
<zin...@sysdev.deutsche-boerse.com>                                            |
|                    |                                                          
                                                    cc|
|                    |        VMSPERL@PERL.ORG                                  
                                                      |
|                    |                                                          
                                               Subject|
|                    |        Re: Spurious linebreak in non-record output       
                                                      |
|                    |                                                          
                                                      |
|                    |                                                          
                                                      |
|                    |                                                          
                                                      |
|                    |                                                          
                                                      |
|                    |                                                          
                                                      |
|--------------------+---------------------------------------------------------------------------------------------------------------->
  >---------------------------|
  |                           |
  >---------------------------|





On Apr 21, 2011, at 10:47 AM, Dr. Martin P.J. Zinser wrote:

> Hello Craig,
>
> nobody used the dirty Oracle word around here, just because something is
a table
> it does not have do come from a database ;-)

Sorry.  I promise to wash my mouth out with soap :-).

> Anyhow, I made some progress and have an easy reproducer plus example
output and
> config information all wrapped up at
http://zinser.no-ip.info/www/trans/lineb.zip
>
> No other modules but CGI are involved in the example. The version I use
is 3.49.
> For best effect look at the output files in a terminal set to 132.
>
> The terminal output was created with perl lineb.pl >terminal.txt
>
> The web output was captured with
> "View Source" from a Web browser.
>
> The Webserver in question is an OSU 3.11 server, communication betweeen
the server
> and perl is via a local DECnet task.
>

Yikes.  I've never used OSU and I haven't touched a DECnet object in about
20 years, but it's pretty clear that you're getting the extra linebreak
every 4096 bytes just like what was happening before with record-oriented
files.  This will change in 5.14.0 to every 32768 bytes, or you can edit
the buffer size yourself by modifying perlio.c.

You can see from the fix for that:

http://perl5.git.perl.org/perl.git/commitdiff/5e7d60de18218a624f7f6d5c99bdaf0ff03973df


that I limited it to regular files [S_ISREG(statbuf.st_mode) is true] with
variable or variable with fixed control.  It occurred to me at the time
that there might be other record-oriented widgets that need similar
treatment, but there is danger in casting the net too wide; binary data
streams could be corrupted, for example.

To me it seems unlikely that DECnet objects would always only transport
text-oriented data, so it probably isn't safe to line buffer them because
that would introduce a record boundary for every newline in the data
stream, which is right for text data but not for binary data.

So I'm not sure what the fix is, or if there is one.  Using a
record-oriented widget to implement a stream-oriented protocol like HTTP
seems like asking for trouble, but it is what it is.

The first workaround I would try would be to enable autoflushing with C<$|
= 1;> at the top of your script.  Or you could use syswrite instead of
print to write your data.

________________________________________
Craig A. Berry
mailto:craigbe...@mac.com

"... getting out of a sonnet is much more
difficult than getting in."
                Brad Leithauser



-----------------------------------------
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected by
law. If you are not the intended recipient, please contact the sender and
delete this message. Any unauthorised copying of this message or
unauthorised distribution of the information contained herein is prohibited.

Legally required information for business correspondence/
Gesetzliche Pflichtangaben fuer Geschaeftskorrespondenz:
http://deutsche-boerse.com/letterhead

Reply via email to