Chip Salzenberg <[EMAIL PROTECTED]> writes: > According to Michael G Schwern: >> In the same way that we have open() not fopen, fdopen, freopen... we >> can choose the safest and most sensible technique for determining >> the cwd and use that. > > And there is more than one open. Perl does have fopen/fdopen/freopen, > but they're accessed through other techniques besides the name of the > operator. For example, Perl spells C<fh = fdopen(5, "r")> as C<open > $fh, "<&=5"). The unique technique is there, just pushed out of the > operator name and into its parameters. > And then there's sysopen().
This is exactly the point (I think) Schwern is trying to make. There is 'open', that will do most of the time. If a novice user asks how to open a file, you can say "Well, just 'open $fh, $file'". If you want more than vanilla file access, there are all the other forms of open and open parameters. >From the perspective of 'current directory' there should also be a simple and elegant way that will do in most cases. Advanced tricks can be made possible using separate modules and such. Maybe the basic problem is that 'current directory' is a system dependent file system location that is not a fixed string, although it usually can be represented as a string. Similar to a simple 'open', I think the most common use of 'cwd' (or whatever) is to return a file system location that can be returned to later, much in the sense of 'tell' and 'seek'. I think this can be implemented in a quite fail safe way on most platforms. -- Johan