On Fri, 04 Aug 2000 00:47:06 -0500, J. David Blackstone wrote:

>  As another example, at work we are in love with the $/ variable,
>since we often deal in multi-line records delimited with control-Y's. 
>However, changing this variable affects _everything_, meaning modules
>you want to use might not work unless you only modify $/ with local()
>within a subroutine.  The solution is for the concept of $/ to become
>a per-filehandle value, as in, encapsulation and object-orientation.

I have only one problem with this solution, and that is with the <>
magic file handle. Would it's private $/ stick across files? Well, er,
yes...

That reminds me of another small problem: cross-platform newlines. The
solution often proposed is turning $/ processing into a regex thing. It
is just as often rejected, mainly for speed reasons, I believe, because
it would slowing reading every single line down quite considerably.

Actually, in paragraph mode ($/=''), it already IS processed as a regex,
so basically it is feasable. I think an actual regex is too general. ALl
you need to be able to handle, are the common cases of bare LF, bare CR,
and CR+LF combination. However, there is no more possible magic value
left to assign to $/ that I can think of...

Also, I'd like to be able to output a text file with the same typical
end-of-line sequence as the input file, in particular when using the -i
command line switch. That also implies a per-file-in @ARGV change of,
say, $\, to match what is generally in the input. 

Heh. It looks like I'm trying to make Perl more complex, instead of
simpler... Can we make a simpler implementaion idea that nevertheless
would DWIM?

-- 
        Bart.

Reply via email to