summaryrefslogtreecommitdiff
path: root/pod/modpods/POSIX.pod
blob: 110e46b21b03adeeb69e430edc96aa67dc50001c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
=head1 NAME

POSIX - Perl interface to IEEE 1003.1 namespace

=head1 SYNOPSIS

    use POSIX;
    use POSIX 'strftime';

=head1 DESCRIPTION

The POSIX module permits you to access all (or nearly all) the standard
POSIX 1003.1 identifiers.  Things which are C<#defines> in C, like EINTR
or O_NDELAY, are automatically exported into your namespace.  All
functions are only exported if you ask for them explicitly.  Most likely
people will prefer to use the fully-qualified function names.

To get a list of all the possible identifiers available to you--and
their semantics--you should pick up a 1003.1 spec, or look in the
F<POSIX.pm> module.

=head1 EXAMPLES

    printf "EINTR is %d\n", EINTR;

    POSIX::setsid(0);

    $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
	# note: that's a filedescriptor, *NOT* a filehandle

=head1 NOTE

The POSIX module is probably the most complex Perl module supplied with
the standard distribution.  It incorporates autoloading, namespace games,
and dynamic loading of code that's in Perl, C, or both.  It's a great
source of wisdom.

=head1 CAVEATS 

A few functions are not implemented because they are C specific.  If you
attempt to call these, they will print a message telling you that they
aren't implemented, and suggest using the Perl equivalent should one
exist.  For example, trying to access the setjmp() call will elicit the
message "setjmp() is C-specific: use eval {} instead".

Furthermore, some evil vendors will claim 1003.1 compliance, but in fact
are not so: they will not pass the PCTS (POSIX Compliance Test Suites).
For example, one vendor may not define EDEADLK, or the semantics of the
errno values set by open(2) might not be quite right.  Perl does not
attempt to verify POSIX compliance.  That means you can currently
successfully say "use POSIX",  and then later in your program you find
that your vendor has been lax and there's no usable ICANON macro after
all.  This could be construed to be a bug.