in reply to Re^2: A DWIM too far?
in thread A DWIM too far?

FYI, POSIX rename() is atomic. Perl's rename is based on POSIX rename() but Perl may use a different API when compiled on a system that doesn't (appear to) have POSIX rename() (hence the weasel words about it perhaps not silently clobbering). Therefore, Perl's rename will not be atomic on some non-POSIX systems.

I can't think of any APIs that Perl has taken from Win32. Where a Perl API matches a Win32 API it is almost always because the Win32 API was made to match the POSIX (or pre-POSIX) API. While I concur with your preference to "use the safer of the two" when selecting, I'd certainly be more surprised to find Perl using a Win32 API that conflicts with a POSIX API.

BTW, I wish Perl's system() had asynchronous launching built in so that could be done portably. It is rather ironic that asynchronous launching is built into the under-the-covers API that Perl uses but it doesn't expose this nice feature in the language -- well, on nearly OS/2 systems (including Win32) you can use system(1,...) to launch a command into the background, but that isn't portable and making that API choice portable poses problems on less OS/2ish systems like Unix where commands are passed a list of arguments instead of a command line.

- tye        

Replies are listed 'Best First'.
Re^4: A DWIM too far? (POSIX)
by BrowserUk (Patriarch) on Jun 18, 2004 at 19:25 UTC

    I suppose I shouldn't have been surprised that Perl would opt for the POSIX api, even emulating it where the native was (by my definition:) better--but I was.

    What still surprises me is that POSIX still specifies a less useful default behaviour.

    Thanks for telling me about the system( 1, ... ) trick. Is that documented somewhere?

    I've been using  use threads qw[async]; async{ system ...; }; for that for a while now, but that is nice if not portable.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon