|
|
Question : Perl problems using Panic Coda
|
|
Hello,
I recently switched from PC to Mac. It's an iMac running Leopard. I'm a web developer, so I bught Panic Coda, a very cute Text Editor to work on my Perl scripts.
This is what's happening:
- I have a Linux based server running Perl. - I have perl scripts which work perfectly. - If I open a script with coda and then upload it, without even modifying the source code, I receive the 500 Internal Server Error when I try the script again on a web browser. - I entered my server via SSH, and it was even weirder, because if I run the script via SSH it works perfectly, it just doesn't work via web browser. - I've tried with two different browsers: Safari and FireFox. - If I open the same file with CuteFTP (on PC), and upload it without even modifying the source code, it works again.
Could you help me solve this mistery?
Thank you.
|
Answer : Perl problems using Panic Coda
|
|
Because the first line of a script, the name after #! is used as the program to interpret the script. The way you had it at first, it had a windows line ending, which is "\r\n" (ascii character 13, ascii character 10). When Panic Coda uploaded the file, it didn't change the line ending to unix style. So, to unix, the program used to read your script was "/usr/bin/perl\r", which doesn't exist. Now that you have a space after perl, the OS looks for "/usr/bin/perl", which is correct, and passes the option "-w\r" to perl. Perl detects the invalid line endings in the script, and ignores them.
|
|
|
|
|