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

Re: [MacPerl] MacPerl::SetFileInfo Help (fwd)



Some time around 7/2/97 4:20 PM , Chris Nandor wrote something about

>At 13.24 7/2/97, D. Beverly wrote:
>>I agree.  I have lots of scripts that create new files, which I don't
>>want as MPW files, but the SetFileInfo call doesn't always work.  Now at
>>least I know why, and what to do about it, but this "feature" should be
>>explained in the docs.
>
>How do you know it didn't work every time?  Forgive me if you are positive
>you are correct; but just because the Finder says it didn't work, that does
>not mean it didn't work.

I mean that...

open ( OUT, ">$myNewFile" );
# do stuff to the file
MacPerl::SetFileInfo ( 'ALFA', 'TEXT', $myNewFile );
close ( OUT );

does not always result in what I want, which is an Alpha text file, in 
this case.  Sometimes the resulting file is an MPW text file.  If the 
Finder says it didn't work, then it didn't.  The desired effect was not 
achieved.

So now, instead of Matthias' suggestion of open/close/open, I create and 
manipulate the files, close them, then do this, after all files are 
created, and known to exist:

#new files have been created, manipulated, then closed in $newFolder
chdir ( $newFolder ); # probably the CWD anyway, but making sure
@theNewFiles = <*>;
foreach $file  ( @theNewFiles ) {
     MacPerl::SetFileInfo ( 'ALFA', 'TEXT', $file );
}

or, alternately, depending on the structure of the script I am updating, 
simply move the SetFileInfo call to the next line after the file has been 
closed.

The "feature" to which I was referring was not the functionality of 
MacPerl::SetFileInfo, but the untrustworthiness of the open command when 
creating new files, as explained by Matthias, which can lead to other 
file manipulation problems during script execution if there is some sort 
of reliability on the actual existence (or at least recognition of 
existence by Finder) of a file.

Hope this clarifies...

Cheers,

Dave Beverly
webmaster@thecitizennews.com -- http://www.thecitizennews.com/
Mac Manipulator
"I don't do windows!"

**
MacOS is an operating system; OS/2 is half an operating system; windoze 
is a shell; DOS is a boot partition virus... where do you want to go 
today?


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