Re: [MacPerl-AnyPerl] Porting a tool using open() from Unix to Mac

[email protected] (Chris Nandor) Mon, 26 May 2003 07:04:49 -0400
Newsgroups perl.macperl.anyperl
Message-ID <p05200f15baf7a4f91753@[10.0.1.177]>
At 10:14 +0200 2003.05.26, Jan Theofel wrote:
>The open commands seems to make trouble. The script was ported from a Unix
>to Mac and therefore uses the / to separate paths and files. I first run
>the script and it created files having the "/" in the filename.
>
>To correct this I wrote a little sub replacing the / with an : and called
>it in ever opne like that:
>  open(FILEHANDLE, &rewrite_open_str(">path/file.out"))
>This would be similar to
>  open(FILEHANDLE, ">path:file.out");
>
>But the open fails. In $! I only get "invalid argument".
>
>Can someone tell me what's wrong here?

The perlport man page (available via `perldoc perlport` on Unix, and Shuck
on Mac OS) has fairly complete details on path differences.  The bottom
line is that you probably want, in this case, ":path:file.out", as
"path:file.out" would look for a volume named "path", not a directory in
the current working directory named "path".

-- 
Chris Nandor                      [email protected]    http://pudge.net/
Open Source Development Network    [email protected]     http://osdn.com/