POSIX-1003

 view release on metacpan or  search on metacpan

lib/POSIX/Overview.pod  view on Meta::CPAN


=head3 Characters

C<POSIX.pm> provides handlers of property groups, which are affected by
the locale setting as long as all the characters are only single bytes.
We recommend that you use regular expressions, which are more flexible.
This table shows the alternative expressions.

  isalnum     [[:alnum:]]   \p{Alnum}
  isalpha     [[:alpha:]]   \p{Alpha}   \pL
  isascii     [[:ascii:]]   \p{Ascii}
  isblank     [[:blank:]]   \p{Blank}            \h
  iscntrl     [[:cntrl:]]   \p{Control} \p{Cc}
  isdigit     [[:digit:]]   \p{Digit}   \p{Nd}   \d
  isgraph     [[:graph:]]   \p{Graph}
  islower     [[:lower:]]   \p{Lower}   \p{Ll}
  isprint     [[:print:]]   \p{Print}
  ispunct     [[:punct:]]   \p{Punct}   \pP
  isspace     [[:space:]]   \p{Space}
  isupper     [[:upper:]]   \p{Upper}   \p{Lu}
  isxdigit    [[:xdigit:]]  \p{XDigit}  \p{Hex}  [0-9a-fA-F]
              [[:word:]]    \p{Word}             \w

C<\p{PerlSpace}> (C<\s>) is close to the ASCII subdomain of C<\p{Space}>.
The C<\p{Word}> character class is a Perl specific extension.  There are
hundreds more character classes and extensions.  See L<perlunicode>
and L<perluniprops>.

The C<isascii> function is defined by XSI, not POSIX.

=head3 Locale

Locales describe national and language specific facts.
See L<perllocale> for the details.

  setlocale                       ::Locale
  localeconv                      ::Locale
  strcoll                         POSIX.pm
  strxfrm                         POSIX.pm

The functions C<strcoll> and C<strxfrm> are not useful in Perl, which
automatically resolves character set problems.

=head3 Math

  abs          perlfunc           ::Math
  div                             ::Math
  rand         perlfunc           ::Math
  srand        perlfunc           ::Math

Integers which overflow will automatically upgrade into floats, so all
C<abs>, C<labs>, C<llabs>, C<imaxabs> are implemented by L<perfunc/abs>.
Division via C<div>, C<ldiv>, C<lldiv>, and C<imaxdiv> are also
equivalent.

The following functions where first defined by C99, and describe
the handling of floating-point rounding and exceptions.  They are
not supported:

  feclearexcept, fegetenv, fegetexceptflag, fegetround, feholdexcept,
  feraiseexcept, fesetenv, fesetexceptflag, fesetround, fetestexcept,
  feupdateenv

=head3 Time

The L<POSIX::1003::Time> code provides access to all time functions.
The result depends on the locale setting of the timezone.  See also
L</Timer Interfaces>.

L<Date::Format> contains pure Perl implementations for the other functions
of this section.  Those are fully portable, which cannot always be said
for POSIX library implementations.  Also L<Date::Calc> may be very
userful.

Use L<Time::HiRes> if you need to handle timestamps with better
resolution than seconds.

  asctime                         ::Time Date::Format
  ctime                           ::Time Date::Format
  difftime                        ::Time Time::HiRes/tv_interval
  gmtime      perlfunc            ::Time Date::Calc/Gmtime
  localtime   perlfunc            ::Time Date::Calc/Localtime
  mktime                          ::Time Date::Calc/Mktime
  strftime                        ::Time Date::Format
  tzname                          ::Time  
  tzset                           ::Time  

=head3 Sorting

  qsort       perlfunc/sort
  bsearch                         POSIX::bsearch Search::Dict
                                  Tree Tree::Binary

The Quick Sort implemented by C<qsort> was used in L<perlfunc/sort>
uptil release 5.6.  Later, it became more flexible.  See the manual
page about the sort pragma: sort(3pm).

=head3 Memory management

Perl uses its own reference counting memory management (of course
based on the POSIX interface).  Only when you write XS code, you
will use abstractions of these: C<calloc>, C<free>, C<malloc>
and C<realloc>.

  memchr      perlfunc/index
  memcmp      perlop/cmp perlop/eq
  memcpy      perlop/=
  memmove     perlop/substr
  memset      perlop/x         $a = 'A' x 100;
  offsetof    perlfunc/unpack  # removed from POSIX standard

=head3 Var-args

All functions in Perl can handle a variable list of arguments, so

  va_arg      not needed
  va_copy     not needed
  va_end      not needed
  va_start    not needed

=head2 Wide-Character ISO C Library Interfaces

lib/POSIX/Overview.pod  view on Meta::CPAN

=head2 Semaphore Interfaces

POSIX semaphores are supported by L<POSIX::RT::Semaphore>:

  sem_close                       POSIX::RT::Semaphore/close
  sem_destroy                     POSIX::RT::Semaphore/destroy
  sem_getvalue                    POSIX::RT::Semaphore/getvalue
  sem_init                        POSIX::RT::Semaphore/init
  sem_open                        POSIX::RT::Semaphore/open
  sem_post                        POSIX::RT::Semaphore/post
  sem_timedwait                   POSIX::RT::Semaphore/timedwait
  sem_trywait                     POSIX::RT::Semaphore/trywait
  sem_unlink                      POSIX::RT::Semaphore/unlink
  sem_wait                        POSIX::RT::Semaphore/wait

=head2 Shell and Utilities Interfaces

  pclose       perlfunc/close
  popen        perlfunc/open ('|-' or '-|')  perlfunc/qx
  system       perlfunc
  wordexp      perlfunc/glob
  wordfree     never needed

=head2 Signal Interfaces

Signal handling is provided via L<POSIX::1003:SigAction> and
L<POSIX::SigSet>. Take a look at those manuals.

  abort        perlvar/%SIG
  alarm        perlfunc
  kill         perlfunc           ::Signals
  pause                           ::Signals
  psiginfo     not supported
  psignal      not supported
  raise                           ::Signals
  sigaction                       ::Signals
  sigaddset                       ::Signals
  sigdelset                       ::Signals
  sigemptyset                     ::Signals
  sigfillset                      ::Signals
  sigismember                     ::Signals
  signal       perlvar/%SIG       ::Signals
  sigpending                      ::Signals
  sigprocmask                     ::Signals
  sigsuspend                      ::Signals
  sigwait      not supported
  strsignal                       ::Signals

B<Warning>, parameter order in POSIX.pm

  CORE::kill($signal, $pid);
  ::Signals::kill($signal, $pid);
  POSIX::kill($pid, $signal);

=head2 Single Process Interfaces

  confstr                         ::Confstr
  environ     perlvar/%ENV
  errno       perlvar/$ERRNO      $!+0
  getenv      perlvar/%ENV        $ENV{PATH}
  setenv      perlvar/%ENV        $ENV{HOME} = '/tmp'
  sysconf                         ::Sysconf
  uname                           ::OS
  unsetenv    perlvar/%ENV        delete $ENV{PS1}

The error constants are provided by L<Errno|Errno>.

=head2 Symbolic Link Interfaces

  lchown                          ::FS
  lstat       perlfunc
  readlinkat  not supported
  readlink    perlfunc
  symlinkat   not supported
  symlink     perlfunc

B<Warning,> POSIX.pm accepts only one filename

  CORE::chown($uid, $gid, @filename);
  ::FS::lchown($uid, $gid, @symlinks);
  POSIX::lchown($uid, $gid, $symlink); # !!!

=head2 System Database Interfaces

  getgrgid    perlfunc            User::grent
  getgrnam    perlfunc            User::grent
  getpwnam    perlfunc            User::pwent
  getpwuid    perlfunc            User::pwent

=head2 Timer Interfaces

  clock_getres                    Time::HiRes POSIX::RT::Clock
  clock_gettime                   Time::HiRes POSIX::RT::Clock
  clock_settime                   Time::HiRes POSIX::RT::Clock
  nanosleep                       Time::HiRes POSIX::RT::Clock
  timer_create                    POSIX::RT::Timer
  timer_delete                    POSIX::RT::Timer
  timer_getoverrun                POSIX::RT::Timer
  timer_gettime                   POSIX::RT::Timer
  timer_settime                   POSIX::RT::Timer

=head2 User and Group Interfaces

Expect portability issues on this subject.  Better B<not use any of
these>, but use the abstract L<POSIX::1003::User> instead!

  cuserid                         ::Proc
  getegid     perlvar/$EGID $)    ::User
  geteuid     perlvar/$EUID $>    ::User
  getgid      perlvar/$GID  $(    ::User
  getgroups   perlvar/$GID  $(    ::User
  getlogin    perlfunc            ::User
  getuid      perlvar/$UID  $<    ::User    # warning
  setegid     perlvar/$EGID $)    ::User    # warning
  seteuid     perlvar/$EUID $>    ::User    # warning
  setgid      perlvar/$GID  $(    ::User    # warning
  setuid      perlvar/$UID  $<    ::User    # warning

B<Warning:> The special variables for user- and group-ids try to be smart:
they are implemented using C<getreuid> and/or friends.  POSIX.pm provides
C<setuid> and C<setgid> which simply call the special variables. So:
both do not offer access to the system functions with that name.

=head2 Wide Character Device Input and Output Interfaces



( run in 0.820 second using v1.01-cache-2.11-cpan-6aa56a78535 )