in reply to I can't find anything

Sometimes I think there should be a section at the top of Perlfunc that lists the unixisms that have been turned into keywords. Things like 'unlink' and 'stat' are not in the slightest bit intuitive for a non unix person, and as such shouldnt have been used as perl keywords, but since they were they should be highlighted as being derived from the *nix world. (I took me longer than I want to admit when I first started using perl to figure out how to get it to delete a file. :-)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


Replies are listed 'Best First'.
Re: Re: I can't find anything
by Anonymous Monk on Nov 07, 2003 at 07:38 UTC
    Seems to like that already happens, from perlfunc
      ...
    • DESCRIPTION
      • Perl Functions by Category ....
        Functions for filehandles, files, or directories

        -X, chdir, chmod, chown, chroot, fcntl, glob, ioctl, link, lstat, mkdir, open, opendir, readlink, rename, rmdir, stat, symlink, sysopen, umask, unlink, utime

      • Portability
        Perl was born in Unix and can therefore access all common Unix system calls. In non-Unix environments, the functionality of some Unix system calls may not be available, or details of the available functionality may differ slightly. The Perl functions affected by this are:

        -X, binmode, chmod, chown, chroot, crypt, dbmclose, dbmopen, dump, endgrent, endhostent, endnetent, endprotoent, endpwent, endservent, exec, fcntl, flock, fork, getgrent, getgrgid, gethostent, getlogin, getnetbyaddr, getnetbyname, getnetent, getppid, getprgp, getpriority, getprotobynumber, getprotoent, getpwent, getpwnam, getpwuid, getservbyport, getservent, getsockopt, glob, ioctl, kill, link, lstat, msgctl, msgget, msgrcv, msgsnd, open, pipe, readlink, rename, select, semctl, semget, semop, setgrent, sethostent, setnetent, setpgrp, setpriority, setprotoent, setpwent, setservent, setsockopt, shmctl, shmget, shmread, shmwrite, socket, socketpair, stat, symlink, syscall, sysopen, system, times, truncate, umask, unlink, utime, wait, waitpid

        For more information about the portability of these functions, see the perlport manpage and other available platform-specific documentation.

        ...
    Now I didn't come from a unix background, in fact I wasn't very knowledgable at all, but I managed to find unlink by looking at perlfunc.
Re: Re: I can't find anything
by ysth (Canon) on Nov 07, 2003 at 04:21 UTC
    Unlinking (er, I mean deleting) a file can be harder than it looks. In the perl core tests, 1 while unlink $file is often used (to support filesystems that allow multiple versions of a file). This occasionally causes problems when a close() is left out, since at least one platform has the interesting tactic of working around not being able to delete an open file by having unlink() schedule the file for later deletion but return true (causing the 1 while unlink to endlessly loop).

    If you are downvoting this for other than lack of interest, thanks for sending me a message or reply to let me know why so I can do better (or just stay quiet) next time.

Re^2: I can't find anything
by Aristotle (Chancellor) on Nov 09, 2003 at 12:08 UTC

    I don't know how much experience with the Unixoid computing world you have, but if you'd been there, you'd notice there is almost nothing in Perl that wasn't in a lesser tool before. We've all heard that Perl is derived from C, shell, awk and sed; until you've learned those tools to a significant degree you won't recognize just how much truth there is in that statement.

    The number of things "chosen" amounts to very nearly zero.

    As such, unlink and friends couldn't have been called any differently.

    I believe that the documentation of the Unixoid assumptions in Perl called for for the folks on Windows actually needs to document a fair amount of additional concepts besides just which function names where used for Perl builtins.

    (I'm twitching to keep myself from it, but cannot help commenting that the more I absorb Unix, the more Windows feels like the far overgrown quick & dirty hack of an 8080 OS it is. And I'm not even talking about the codebase (which has been done from scratch in NT anyway and would be fixable with an undue amount of effort), I'm talking about concepts. Unix, as a design, makes sense. And it's not even perfect - there's a lot to do better yet.)

    Makeshifts last the longest.