print bug

print bug

am 25.07.2007 18:05:36 von Jeff Sadowski

I noticed a bug/"undesirable feature" in activeperl's print.
every time there is a \n activeperl's print prints \r\n
this might be ok for text but it replaces it in binary as well.
I was using a perl script to display a few images as a proxy
and it screws up the images.

use WWW::Mechanize;
my $m = WWW::Mechanize->new();
my $someimage="http://path/to/some/image.jpg";
$m->get($someimage);
my $data = $m->content;
my $contenttype=$m->ct;
print "Content-type: " . $contenttype . "\n\n";
print $data;

If I wanted a \r\n I could easily have added this if I wanted I think
this is a bad idea to be implemented in the print command.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: print bug

am 25.07.2007 18:23:19 von eroode

Look up the "binmode" function.


Eric

-----Original Message-----
From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Jeff
Sadowski
Sent: Wednesday, July 25, 2007 12:06 PM
To: activeperl@listserv.ActiveState.com
Subject: print bug

I noticed a bug/"undesirable feature" in activeperl's print.
[...]
If I wanted a \r\n I could easily have added this if I wanted I think
this is a bad idea to be implemented in the print command.
_______________________________________________
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs