in reply to Flawless Script problems?
One of the first things CGI.pm does on Win32 is binmode STDIN, STDOUT and STDERR. A side effect of binmode is that perl no longer does its transparent line-end adjustments.
Try this little demo:
use strict; use warnings; print "Just hit enter (before CGI)"; my $var = <STDIN>; print ":", ord $_, ":" for (split //, $var); print "\nChomping\n"; chomp $var; print ":", ord $_, ":" for (split //, $var); print "\n"; eval 'use CGI;'; print "Just hit enter (after CGI)"; $var = <STDIN>; print ":", ord $_, ":" for (split //, $var); print "\nChomping\n"; chomp $var; print ":", ord $_, ":" for (split //, $var); __END__ output: Just hit enter (before CGI) :10: Chomping Just hit enter (after CGI) :13::10: Chomping :13:
As you see, there is a carriage return left after using CGI that isn't there before CGI.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Flawless Script problems?
by sulfericacid (Deacon) on Mar 13, 2003 at 20:39 UTC | |
by pfaut (Priest) on Mar 13, 2003 at 20:59 UTC | |
by sulfericacid (Deacon) on Mar 14, 2003 at 04:20 UTC |