SPUG: No such file?

Todd Wells toddw at wrq.com
Mon Jan 31 10:25:11 CST 2000


Well, you were very close to the actual scenario.  Actually I started to
write the program on a unix box, I've (almost) finished it on a unix box,
but somewhere along the way it did pass through an NT box via binary FTP.  I
always wondered what purpose ASCII transfers served in FTP -- I just figured
bits is bits so why not just do it all binary?

I used Andrew's 'tr -d "\r" < f1 > f2' and that solved the problem
beautifully.

Special thanks to William, Tim Maher, Stuart Poulin, and Riley for their
efforts in solving this.

-Todd

-----Original Message-----
From: William Julien [mailto:moonbeam at catmanor.com]
Sent: Friday, January 28, 2000 5:49 PM
To: spug-list at pm.org
Subject: Re: SPUG: No such file?


>
>What is going on here?
>
>When I run this program with "#!/usr/bin/perl -w" as the first line, I get
>this spew:
>
>bash-2.03$ app.pl
>Name "main::hash" used only once: possible typo at ./apptrieve.pl line
1137.
>Unquoted string "adm" may clash with future reserved word at (eval 1) line
>26, <CONFIG> chunk 36.
>Unquoted string "dev" may clash with future reserved word at (eval 1) line
>27, <CONFIG> chunk 36.
>Unquoted string "other" may clash with future reserved word at (eval 1)
line
>29, <CONFIG> chunk 36.
>
>Okay, that's fine, I can deal with it.  But if I remove the "-w", I get
>this!  
>
>bash-2.03$ app.pl
>bash: ./app.pl: No such file or directory
>

Let me guess. Was the program was written on a winbox and uploaded to a unix
server in binary mode? So, the unix shell sees the dos line end character
on the header. In a "real man's editor"... like uh, ... vi!; you would see:
"/usr/bin/perl^M".  Guess what... there is "No such file or directory"
by that name!

You may ask, but, why does this act differently when the "-w" parameter
is inserted on the shell header? The syntax for the normal unix getopt
processing allows for the grouping of parameters (-x -y == -xy). So,
perl parses the paramters of "-w^M" as "-w -^M".  This is why you saw the
normal warnings with the perl diagnostic checking enabled. I'm a little
surprised that perl didn't give an error on the invalid "-^M" parameter.
Perl 5.005_03 will abort on an invalid parameter error.

Moral: use ascii transfer for text files.

This is not as easy as it sounds. Some win9x ftp clients decide "for you",
because they run on the assumption that you are an idiot and you don't
know what you are doing. They use the extension to determine the transfer
method and they default to binary. There are a lot of windows programmers
who have never heard of perl.

Second Moral: Friends don't let friends use dos.
---
        _,'|            _.-''``-...___..--';
       /, \'.      _..-' ,      ,--...--'''
      < \   .`--'''      `     /| William Julien moonbeam at catmanor.com
       `-,;'              ;   ; ; http://www.catmanor.com/moonbeam/
 __...--''     __...--_..'  .;.'  vi is my shepherd; i shall not font.
(,__....----'''      (,..--''     
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list