[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] <> Inplace editing question



Thanks.  I thought <> was working on @_ instead of @ARGV.  I rewrote the
code to generate a corrected ARGV instead of using your method (TMTOWTDI).

Kevin

At 2:44 PM -0400 8/8/1998, Paul J. Schinder wrote:
>On Sat, 8 Aug 1998 10:20:06 -0500, Kevin van Haaren wrote:
>>
>>I'm trying to adapt one of Chris Nandor's examples from the MacPerl CD.  I
>>want a droplet to take a directory and process all the files in the
>>directory to convert Unix line endings to Mac line endings. The example
>on
>>the CD works with dropped files, but not directories.
>>
>>For some reason, with the code below, if I drop a files it works fine.  If
>>I drop a directory, it doesn't work.  I added the line in the lf2cr
>>subroutine print "@_n"; to test what's being passed into the subroutine.
>>I'm testing with a directory that contains one file.  If I drop the file,
>>the output is:
>>Data:WWW:kvh-bin:Text:Ini.pm
>>and everything works.
>>
>>If I drop a directory, the output is:
>>Data:WWW:kvh-bin:Text:Ini.pm
>># Can't open Data:WWW:kvh-bin:Text: No such file or directory
>
>Error messages almost always mean what they say. Perl is complaining
>because you're trying to open() a directory. Here's why...
>
>[ poof ]
>
>>
>>while (<>) {
>
>Chris' script is using Perl's "magic" angle brackets. But these work on
>@ARGV, not on @_. So it tries to open $ARGV[0], which contains the name of
>the folder. Hence the error message.
>
>You should rewrite this to be something like
>
>open (FILE $_[0]) or die "Unable to open $_[O]";
>while (<FILE>) {
>
>
>
>-------
>Paul J. Schinder
>schinder@pobox.com




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch