in reply to Re: Detect line endings with CGI.pm upload
in thread Detect line endings with CGI.pm upload
Since we're using CGI.pm's upload function, $file is the file name on the client computer (in a scalar context) or a file-handle, but not the contents of the file itself. As such, $file =~ s/(\x0d?\x0a|\x0d)/\n/smg; is performing the substitution on the file name, not the contents of the file. But, its a good idea.
Manually setting $/ works but how do I detect what the line-ending should be so I can set $/ programmatically? perlvar is very explicit about it being a string, not a regex, so that's not an option. And the line-ending can be different for each of the three files being uploaded, even within a single CGI upload, so I cannot even do something based on the browser User-Agent.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Detect line endings with CGI.pm upload
by gwadej (Chaplain) on Dec 28, 2008 at 21:01 UTC |