Mailing List Archive

1 2  View All
Re: [PERL] function classification [ In reply to ]
>According to Tim Bunce:
>> Names are crucial.

>Yup. I seem to recall that one of the UNIX pioneers (DMR?) was asked,
>if he could do UNIX again, what he would do differently. He said that
>he would spell creat() with an "e".

(Hm... checking on the ken|dmr|brk thing.)

I decided not to go with one-word descriptions. Here's
the current working set. I'm very amenable to mutation.

--tom



=head2 Perl Functions by Category

Here are Perl's functions (including things that look like functions, like
some of the keywords and named operators) arranged by category. Some
functions appear in more than one place.

=over

=item Functions for SCALARs or strings

chomp, chop, chr, crypt, hex, index, lc, lcfirst, length,
oct, ord, pack, q/STRING/, qq/STRING/, reverse, rindex,
sprintf, substr, tr///, uc, ucfirst, y///

=item Regular expressions and pattern matching

m//, pos, quotemeta, s///, split, study

=item Numeric functions

abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt,
srand

=item Functions for real @ARRAYs

pop, push, shift, splice, unshift

=item Functions for list data

grep, join, map, qw/STRING/, reverse, sort, unpack

=item Functions for real %HASHes

delete, each, exists, keys, values

=item Input and output functions

binmode, close, closedir, dbmclose, dbmopen, die, eof,
fileno, flock, format, getc, print, printf, read, readdir,
rewinddir, seek, seekdir, select, syscall, sysread,
syswrite, tell, telldir, truncate, warn, write

=item Functions for fixed length data or records

pack, read, syscall, sysread, syswrite, unpack, vec

=item Functions for filehandles, files, or directories

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

=item Keywords related to the control flow of your program

caller, continue, die, do, dump, eval, exit, goto, last,
next, redo, return, sub, wantarray

=item Keywords related to scoping

caller, import, local, my, package, use

=item Miscellaneous functions

defined, dump, eval, formline, local, my, reset, scalar,
undef, wantarray

=item Functions for processes and process groups

alarm, exec, fork, getpgrp, getppid, getpriority, kill,
pipe, qx/STRING/, setpgrp, setpriority, sleep, system,
times, wait, waitpid

=item Keywords related to perl modules

do, import, no, package, require, use

=item Keywords related to classes and object-orientedness

bless, dbmclose, dbmopen, package, ref, tie, untie, use

=item Low-level socket functions

accept, bind, connect, getpeername, getsockname,
getsockopt, listen, recv, send, setsockopt, shutdown,
socket, socketpair

=item System V interprocess communication functions

msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop,
shmctl, shmget, shmread, shmwrite

=item Fetching user and group info

endgrent, endhostent, endnetent, endpwent, getgrent,
getgrgid, getgrnam, getlogin, getpwent, getpwnam,
getpwuid, setgrent, setpwent

=item Fetching network info

endprotoent, endservent, gethostbyaddr, gethostbyname,
gethostent, getnetbyaddr, getnetbyname, getnetent,
getprotobyname, getprotobynumber, getprotoent,
getservbyname, getservbyport, getservent, sethostent,
setnetent, setprotoent, setservent

=item Time-related functions

gmtime, localtime, time, times

=back
Re: [PERL] function classification [ In reply to ]
>Yup. I seem to recall that one of the UNIX pioneers (DMR?) was asked,
>if he could do UNIX again, what he would do differently. He said that
>he would spell creat() with an "e".

it was ken.

--tom
Re: [PERL] function classification [ In reply to ]
tc> Some functions appear in more than one place.

tc> =item Functions for SCALARs or strings
tc>
tc> chomp, chop, chr, crypt, hex, index, lc, lcfirst, length,
tc> oct, ord, pack, q/STRING/, qq/STRING/, reverse, rindex,
tc> sprintf, substr, tr///, uc, ucfirst, y///

qx/STRING/ could also be here, then? It should be present in
'Process' as Larry noticed but folks are gonna be mightily
confused if ' and "" are here so to speak but ` isn't.

tc> binmode, close, closedir, dbmclose, dbmopen, die, eof,
tc> fileno, flock, format, getc, print, printf, read, readdir,
tc> rewinddir, seek, seekdir, select, syscall, sysread,
tc> syswrite, tell, telldir, truncate, warn, write

syscall? Input and output? Ah well, if you syscall(&SYS_write, ...) :-)
I know, syscall is a toughie. But really, I do not see why it is here.

tc> =item Functions for fixed length data or records
tc>
tc> pack, read, syscall, sysread, syswrite, unpack, vec

syscall here is fine, you normally have to fiddle around with
pack() before you do your syscall() dance.

tc> =item Keywords related to the control flow of your program
tc>
tc> caller, continue, die, do, dump, eval, exit, goto, last,
tc> next, redo, return, sub, wantarray

syscall here, perhaps? You do call a function, right? Not so
much unlike do aka &.

tc> =item Keywords related to classes and object-orientedness
tc>
tc> bless, dbmclose, dbmopen, package, ref, tie, untie, use

dbmopen 'classy'? I do realise that it is here because of tiedness
but really, come on? Move them to 'Misc'?

++jhi;

1 2  View All