tachyon has asked for the wisdom of the Perl Monks concerning the following question:
In How to make a CPAN module Ditribution I noted that there are issues with ^M ie the CR part or CRLF that you get for a line ending on Win32 when you move such a script to Linux. A monk just noted that he was less than convinced. I was thinking scripts (rather than Modules but you always have test scripts in a distro). Here is the evidence relating to the problem I get:
[root@devel3 root]# cat bad.pl #!/usr/bin/perl print "Hello Errors!\n" [root@devel3 root]# perl -pe 's/\015/^M/' bad.pl #!/usr/bin/perl^M print "Hello Errors!\n"^M [root@devel3 root]# ./bad.pl : bad interpreter: No such file or directory [root@devel3 root]# perl -pi -e 's/\015//' bad.pl [root@devel3 root]# ./bad.pl Hello Errors! [root@devel3 root]# perl -pe 's/\015/^M/' bad.pl #!/usr/bin/perl print "Hello Errors!" [root@devel3 root]#
So you can see that the \015 is present and causes the breakage shown which goes away when you make the \015s go away. Q: Why is it so?
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why does Perl choke on \015 ^M chars
by Paladin (Vicar) on Jan 03, 2004 at 04:26 UTC | |
by liz (Monsignor) on Jan 03, 2004 at 09:56 UTC | |
by tachyon (Chancellor) on Jan 03, 2004 at 04:30 UTC | |
|
Re: Why does Perl choke on \015 ^M chars
by revdiablo (Prior) on Jan 03, 2004 at 06:30 UTC | |
|
Re: Why does Perl choke on \015 ^M chars
by PodMaster (Abbot) on Jan 03, 2004 at 05:41 UTC |