punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:

Molka Monks,

I have several Perl scripts in my account's cgi-bin. They ahve been there for over a year and running perfectly to this day.

Before doing an update, I recuperated a copy from the server and saved a copy of this original away. Made a few changes and uploaded it, ran it - the dreaded "Internal Server Error".

After much scratching of the head and searching fruitlessly for the typo, re-uploaded the original. To my great dismay - the exact same thing - Internal Server Error. This is the script that was working perfectly just 10 minutes ago with no changes. Check permissios - 755, no problem.

So, to get some info, added "-w" to the first line. And bingo, the script runs perfectly again. No warnings, no messages, just back to running the way it was.

Remove the "-w", won't run; re-add in the "-w", runs again.

So, I wondering what could there be in the setup of Perl or the server that would allow a year old script to run just fine, then stop it from running when re-uploaded with no changes, then allow it to run with the addition of the "-w" switch??

Thanks

Forget that fear of gravity,
Get a little savagery in your life.

  • Comment on Script running OK, re-loaded with no changes, then won't run uintil -w switch added.

Replies are listed 'Best First'.
Re: Script running OK, re-loaded with no changes, then won't run uintil -w switch added.
by PodMaster (Abbot) on Oct 17, 2005 at 00:05 UTC
    So, I wondering what could there be in the setup of Perl or the server that would allow a year old script to run just fine, then stop it from running when re-uploaded with no changes, then allow it to run with the addition of the "-w" switch??
    The error log would've told you, but your webserver can't find the program indicated on the shebang. Why? Because of line endings (you didn't upload in ASCII mode).

    CGI Help Guide

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Script running OK, re-loaded with no changes, then won't run uintil -w switch added.
by graff (Chancellor) on Oct 17, 2005 at 01:39 UTC
    To elaborate slightly on Podmaster's explanation: it wouldn't run without the "-w", because there was an extra character after "perl" -- a carriage return -- and the server does not have an executable file named "/usr/bin/perl\r" (or whatever path you're using.

    Once you add the " -w" and upload again (using a method of file transfer that either adds or retains "\r" before every "\n"), "/usr/bin/perl" is now followed by a space, which is fine. (And once perl starts, it probably does the right thing with "-w\r".)

      and the server does not have an executable file named "/usr/bin/perl\r"
      years ago i thought about the idea if it wouldn't be the best for providers to just have a file "/usr/bin/perl\r" on the system that links to the correct binary. as far as i have tested scripts will run fine.

      not being serious, though =)

        hehe... yes, that would be so clever.

        And when a sysadmin or anyone else does "ls /usr/bin" (and, just by coincidence, "perl\r" does not occur in the right-most column), they'll wonder why that one line of the listing is shorter than expected and has things out of order, and some programs that should be there are not showing up. Think of the fun everyone would have!

Re: Script running OK, re-loaded with no changes, then won't run uintil -w switch added.
by punch_card_don (Curate) on Oct 17, 2005 at 13:05 UTC
    Wow - now that's a pearl of information.

    Thanks.

    Forget that fear of gravity,
    Get a little savagery in your life.