You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gavin Carr <ga...@openfusion.com.au> on 2002/04/12 02:36:51 UTC

Trailing whitespace

I've got an embperl (1.3.4) page that dumps a blob from a database with
an appropriate content type, and I'm finding I'm getting trailing
whitespace when I save the output to disk. For binaries this can be a
problem.

Simple example - a file containing:

  [+ 'abc' +]

gets saved as (od -c output):

0000000   a   b   c  \n  \r  \n
0000006

Similarly,

  [- print OUT 'abc' -]

produces:

0000000   a   b   c  \r  \n
0000005

This is true even if the epl file doesn't contain a trailing eol. Any
idea where this is coming from (embperl? apache?), and if there's an
easy way of suppressing it? 

I suppose I could try rewriting it as a CGI, but then it becomes
stylistically distinct from all the other pages in this app ...

Cheers,
Gavin


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Trailing whitespace

Posted by Gerald Richter <ri...@ecos.de>.
>
> Thanks - I had a 'local $escmode = 0' in the original, which I guess
> does the unescaping but not the whitespace munging due to scope. The
> escaping gets rid of the final \r\n, which is what I was after.
>

Embperl 1.3 append a \r\n at the end of the output if $escmode isn't 0 at
the end of the file. Because of your your local $escmode was not zero at
eof.

Embperl 2.0b7 doesn't append this \r\n anymore at all.

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Trailing whitespace

Posted by Gavin Carr <ga...@openfusion.com.au>.
On Fri, Apr 12, 2002 at 05:52:59AM +0200, Gerald Richter wrote:
> > I've got an embperl (1.3.4) page that dumps a blob from a database with
> > an appropriate content type, and I'm finding I'm getting trailing
> > whitespace when I save the output to disk. 
> 
> You have to turn of escaping
> 
> > For binaries this can be a
> > problem.
> > 
> > Simple example - a file containing:
> > 
> Add
> 
> [- $escmode = 0 -]
> 
> >   [+ 'abc' +]
> > 
> 
> This will turn of escaping and also remove the trailing whiltespace

Thanks - I had a 'local $escmode = 0' in the original, which I guess
does the unescaping but not the whitespace munging due to scope. The 
escaping gets rid of the final \r\n, which is what I was after.

I've gone with the [- print OUT 'abc' -] version, since the [+ 'abc' +]
one includes the final eol from the epl file (if it's there).

Cheers,
Gavin


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Trailing whitespace

Posted by Gerald Richter <ri...@ecos.de>.
> 
> I've got an embperl (1.3.4) page that dumps a blob from a database with
> an appropriate content type, and I'm finding I'm getting trailing
> whitespace when I save the output to disk. 

You have to turn of escaping

> For binaries this can be a
> problem.
> 
> Simple example - a file containing:
> 
Add

[- $escmode = 0 -]

>   [+ 'abc' +]
> 

This will turn of escaping and also remove the trailing whiltespace

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org