Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Nov 23, 2009 4:10 am 
Offline
Junior Member

Joined: Mon Nov 23, 2009 2:38 am
Posts: 22
My perl script wouldn't work, coming up with server error until I put the "-w" on the end of the shebang. Now it works perfectly, no errors.

Why???


Top
   
 Post subject:
PostPosted: Mon Nov 23, 2009 1:09 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
-w is very similar to the "use warnings" option, and you're generally expected to always use it. In fact, the man page for PERL lists as a bug that -w is not mandatory (implying that the PERL developers feel that it should be).

I'm not a PERL developer, but my guess is that omitting -w treats warnings as errors, hence why your script won't run. But again, that's just a guess. Ideally, you'd have no warnings, and so there'd be no difference between using -w or not.


Top
   
PostPosted: Mon Nov 23, 2009 4:05 pm 
Offline
Senior Member

Joined: Sat Dec 04, 2004 5:36 pm
Posts: 145
ybop wrote:
My perl script wouldn't work, coming up with server error until I put the "-w" on the end of the shebang. Now it works perfectly, no errors.

Why???


Can you post the exact error message for even a simple test case, please? It would be very helpful in assisting us with assisting you in figuring this out. :-)


Top
   
PostPosted: Mon Nov 23, 2009 11:15 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
ybop wrote:
My perl script wouldn't work, coming up with server error until I put the "-w" on the end of the shebang. Now it works perfectly, no errors.

Why???


This is a guess:

You wrote the script (or transferred or it something) through a Windows machine and so you have CRLF line endings. This means your first line was really
#!/usr/bin/perl^M
(with the ^M meaning a carriage-return).

Of course there is no program /usr/bin/perl^M and so the OS refused to run it.

By adding "-w" you turned it into
#!/usr/bin/perl -w^M
and this ran OK (perl ignored the ^M).

If this is your problem then "dos2unix" will fix your file. You should then look into how you transfer your programs and ensure you have the correct line endings for unix (just a LF).

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Tue Nov 24, 2009 3:28 am 
Offline
Junior Member

Joined: Mon Nov 23, 2009 2:38 am
Posts: 22
Thank you! That was it :) I wrote the script about 10 years ago but in the process of transferring it to a new host, it seems an errant CR found it's way where it oughtn't.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group