[Bioperl-l] Root::IO handle Mac and Win32 LF

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Tue Dec 16 11:03:36 EST 2003


Jason Stajich wrote:
> It stems from this report
>  http://bugzilla.bioperl.org/show_bug.cgi?id=1570
> 
> I don't know if he is running clustalw on windows and then trying to run
> perl on the file in unix or what.  If that is the case I think it is in
> order to unix-ify the file when they are moved over and not up to bioperl.
> 
> We already had code in Root::IO like this:
>  $line =~ s/\r\n/\n/ if( (! $param{-raw}) && (defined $line);
> 
> I have no recollection of when it was added or by whom, I could be the
> guilty party but I really don't remember.
> 
> So I don't have the answers to your questions:
> Q1:  What byte sequence in the data do you want to change to what?
> Q2:  What operating system is the code running on?
> 
> I think the intention here was that if
>  perl -i -e -p 's/\n\r/\n/g' file.dnd
> cleaned up the problem, why shouldn't that be part of the IO input
> automatically.
> 
> I'm going to pass on fixing this bug for now.  Hopefully someone else will
> get inspired from this discussion and test and propose THE RIGHT solution.
> 
> -jason

Ah, now that's interesting. In this specific case the application, 
newick.pm, has explicitly opted out of Perl's end-of-line handling by 
redefining $/ so it can slurp the whole tree at once:

    local $/ = ";\n";
    return unless $_ = $self->_readline;

Which, IMHO, makes it its problem to deal with line breaks.

So, unless the problem also occurs in regular code using Perl's default 
line break handling, I'd say the bug should be fixed by adding whatever 
code is required in the newick module, not by adding complexity in 
Root::IO for that special case.

Cheers, Dave
-- 
Dave Howorth
MRC Centre for Protein Engineering
Hills Road, Cambridge, CB2 2QH
01223 252960



More information about the Bioperl-l mailing list