in reply to Turning *off* warnings causes the script to fail :(

I ran into something similiar, once... Have you checked to see if your end-of-line character is incorrectly set to '\r\n'? If your script starts with

#!/usr/bin/perl\r\n

it will be looking for a file called 'perl\r' in /usr/bin. Whereas

#!/usr/bin/perl -wT\r\n
Will actually work.

Do a quick 'hexdump -c filename' to see if this is the case.

Update: A bit more about the time I got bit by this.... I had a jr sysadmin working under me put a new 'ifcfg-eth0' to a soon-to-be-production machine with a buch of '\r's in it. It looked something like:

DEVICE=eth0\r IPADDR=xx.xx.194.149\r NETWORK=xx.xx.194.128\r NETMASK=255.255.255.128\r BROADCAST=xx.xx.194.255\r

When we cycled the machine right before deploying it, we lost remote connectivity (it was trying to configure the device 'eth0\r'. We had to go down to the colocation facility and debug if from there. The error message on the screen was 'eth0 no such device' (i.e 'eth0\r no such device') which wasn't particularly helpful. After cycling the machine numerous times and swapping out some hardware, someone noticed that emacs was labeling it as a DOS file. A quick 'perl -pi -e "s/\r//g" ifcfg-eth0' fixed it.

-Blake

Replies are listed 'Best First'.
Re: Re: Turning *off* warnings causes the script to fail :(
by dws (Chancellor) on Aug 21, 2001 at 02:37 UTC
    #!/usr/bin/perl -wT\r\n Will actually work.
    That's my guess. I just verified (on Linux and FreeBSD) that a \r won't screw up the #! line if it appears after a command line option. I assume the kernel stops scanning for the path to the executable as soon as it hits whitespace, and that the presense of command-line options are sufficient to prevent the \r from being considered as part of the path of the executable.

Re: Re: Turning *off* warnings causes the script to fail :(
by one4k4 (Hermit) on Aug 21, 2001 at 17:24 UTC
    'perl -pi -e "s/\r//g" ifcfg-eth0'
    For the life of me, I could never remember the command-line syntax-ish way of doing things like that. I thank you Blake, you just made my job of moving my mod_perl stuffs around. I'll go about figuring out what -pi -e means, but for now.. it works. :)

    _14k4 - perlmonks@poorheart.com (www.poorheart.com)