At 4:18 PM +0000 12/2/98, Kjartan Benediktsson wrote: } } my $resfork = POSIX::open($name,&Fcntl::O_RSRC); } } But I always get syntax error. The O_RSRC flag's value is 16384. What line does MacPerl say is giving the syntax error? This one, or somewhere else in your script? In general, if MacPerl is complaining about a syntax error, that means there's a syntax error. It's not complaning about something that is happening while the script is running, because the script isn't legal and can't run. It reports syntax errors before any code is ever run. This is not failing because you can't open the remote file. Since I just installed a new netatalk at work today, I decided to try this out. I reminded myself of a MacPerl bug (long ago reported) and a possible new bug/feature. Here's my script: #!perl use POSIX; use Fcntl; #$remotename = "The Black Pits:Applications:SimpleText"; # this is a local file # for testing $remotename = "Home:TEMP:SimpleText"; # this is a remote file on a netatalk # server, a functioning copy of SimpleText $localname = "The Black Pits:temp"; my $remote = POSIX::open($remotename,&Fcntl::O_RSRC | &POSIX::O_RDONLY) or die "Unable to open remote"; my $local = POSIX::creat($localname,0644); POSIX::close($local); $local = POSIX::open($localname,&Fcntl::O_RSRC | &POSIX::O_CREAT | &POSIX::O_WRONLY) or die "Unable to open local"; my $buf = ''; my $bytes; while (($bytes = POSIX::read($remote,$buf,1024)) > 0) { POSIX::write($local,$buf,$bytes); print "writing $bytes bytes\n"; } POSIX::close($remote); POSIX::close($local); The first thing to notice, which may be a bug or a feature, is that the file has to exist before the resource fork can be opened, in spite of O_CREAT. That's why I do the POSIX::creat. If I don't, the file will be created, but the bytes are written to the data fork, in spite of O_RSRC. The second thing, which is the old bug, is that $bytes has to be explicitly compared to 0 or the loop will run forever. (I vaguely recall that it was coming back as -0 at end of file, or something like that. Whatever was happening at end-of-file, while thought it was true instead of false, and so it kept going.) After the network copy, ResCompare (available at Info-Mac) says the copied resource fork is identical to a local SimpleText. ----- 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