Mark Overmeer > POSIX-1003-0.92 > POSIX::1003

Download:
POSIX-1003-0.92.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  2
View/Report Bugs
Module Version: 0.92   Source   Latest Release: POSIX-1003-0.98

NAME ^

POSIX::1003 - bulk-load POSIX::1003 symbols

SYNOPSIS ^

  use POSIX::1003  qw(:termios :pc PATH_MAX);
  # is short for all of these:
  use POSIX::1003::Termios  qw(:all);
  use POSIX::1003::Pathconf qw(:all);
  use POSIX::1003::FS       qw(PATH_MAX);

  # overview about all exported symbols (by a module)
  show_posix_names 'POSIX::1003::Pathconf';
  show_posix_names ':pc';
  perl -MPOSIX::1003 'show_posix_names'

DESCRIPTION ^

The POSIX::1003 suite implements access to many POSIX functions. The POSIX module in core (distributed with Perl itself) is ancient, the documentation is usually wrong, and it has too much unusable code in it. POSIX::1003 tries to provide cleaner access to the operating system. More about the choices made can be found in section "Rationale".

POSIX

The official POSIX standard is large, with over 1200 functions; POSIX::Overview does list them all. This collection of POSIX::1003 extension provides access to quite a number of those functions, when they are not provided by "core". They also define as many system constants as possible. More functions may get added in the future.

Start looking in POSIX::Overview, to discover which module provides certain functionality. You may also guess the location from the module names listed in "DETAILS", below.

Bulk loading

It can be quite some work to work-out which modules define what symbols and then write down all the explicit require lines. Using bulk loading via this POSIX::1003 will be slower during the import (because it needs to load the location of each of the hundreds of symbols into memory), but provides convenience: it loads the right modules automagically.

Exporter

This module uses nasty export tricks, so is not based in Exporter. Some modules have more than one tag related to them, and one tag may load multiple modules. When you do not specify symbol or tag, then all are loaded into your namespace(!), the same behavior as POSIX has.

If your import list starts with +1, the symbols will not get into your own namespace, but that of your caller. Just like $Exporter::ExportLevel (but a simpler syntax).

  use POSIX::1003 ':pathconf';
  use POSIX::1003 ':pc';       # same, abbreviated name

  use POSIX::1003 qw(PATH_MAX :math sin);

  sub MyModule::import(@)   # your own tricky exporter
  {   POSIX::1003->import('+1', @_);
  }

EXPORT_TAGS

  :all                  (all symbols, default)
  :cs      :confstr     POSIX::1003::Confstr
  :ev      :events      POSIX::1003::Events
  :fd      :fdio        POSIX::1003::FdIO
  :fs      :filesystem  POSIX::1003::FS
  :limit   :limits      POSIX::1003::Limit
  :locale               POSIX::1003::Locale
  :math                 POSIX::1003::Math
  :none                 (nothing)
  :os      :opsys       POSIX::1003::OS
  :pc      :pathconf    POSIX::1003::Pathconf
  :proc    :processes   POSIX::1003::Proc
  :props   :properties  POSIX::1003::Properties
  :posix   :property    POSIX::1003::Properties
  :sc      :sysconf     POSIX::1003::Sysconf
  :signals              POSIX::1003::Signals
  :signals :sigaction   POSIX::SigAction
  :signals :sigset      POSIX::SigSet
  :termio  :termios     POSIX::1003::Termios
  :time                 POSIX::1003::Time

FUNCTIONS ^

posix_1003_modules()

Returns the names of all modules in the current release of POSIX::1003.

posix_1003_names([MODULES|TAGS])

Returns all the names, when in LIST content. In SCALAR context, it returns (a reference to) an HASH which contains exported names to modules mappings. If no explicit MODULES are specified, then all available modules are taken.

show_posix_names([MODULES|TAGS])

Print all names defined by the POSIX::1003 suite in alphabetical (case-insensitive) order. If no explicit MODULES are specified, then all available modules are taken.

DETAILS ^

Modules in this distribution

POSIX::1003::Confstr

Provide access to the _CS_* constants.

POSIX::1003::FdIO

Provides unbuffered IO handling; based on file-descriptors.

POSIX::1003::FS

Some generic file-system information. See also POSIX::1003::Pathconf for more precise info.

POSIX::1003::Locale

Locales, see also perllocale.

POSIX::1003::Math

Standard math functions of unknown precission.

POSIX::1003::OS

A few ways to get Operating system information. See also POSIX::1003::Sysconf, POSIX::1003::Confstr, and POSIX::1003::Properties,

POSIX::1003::Pathconf

Provide access to the pathconf() and its trillion _PC_* constants.

POSIX::1003::Properties

Provide access to the _POSIX_* constants.

POSIX::1003::Signals

With helper modules POSIX::SigSet and POSIX::SigAction.

POSIX::1003::Sysconf

Provide access to the sysconf and its zillion _SC_* constants.

POSIX::1003::Termios

Terminal IO

POSIX::1003::Time

Time-stamp processing

POSIX::1003::Limit

For getting and setting resource limits.

Other modules

User::pwent

Provides an OO interface around getpw*()

User::grent

Provides an OO interface around getgr*()

Unix::SavedIDs

provides access to all (get|set)e?[ug]id functions. Of course, you may use the special variables $( $) $< $> as well, but that gives unpredictable results.

Rationale

The POSIX module as distributed with Perl itself is ancient (it dates before Perl5) Although it proclaims that it provides access to all POSIX functions, it only lists about 200 out of 1200. From that subset, half of the functions with croak when you use them, complaining that they cannot get implemented in Perl for some reason.

Many other functions provided by POSIX-in-Core simply forward the caller to a function with the same name which is in basic perl (see perldoc). With a few serious complications: the functions in POSIX do not use prototypes, sometimes expect different arguments and sometimes return different values.

Back to the basics: the POSIX::1003 provides access to the POSIX libraries where they can be made compatible with Perl's way of doing things. For instance, setuid of POSIX is implemented with $), whose exact behavior depends on compile-flags and OS: it's not the pure setuid() of the standard hence left-out. There is no isalpha() either: not compatible with Perl strings and implemented very different interface from POSIX. And there is also no own exit(), because we have a CORE::exit() with the same functionality.

POSIX::1003 compared to POSIX

This distribution does not add much functionality itself: it is mainly core's POSIX.xs (which is always available and ported to all platforms). You can access these routines via POSIX as well.

When you are used to POSIX.pm but want to move to POSIX::1003, you must be aware about the following differences:

SEE ALSO ^

This module is part of POSIX-1003 distribution version 0.92, built on February 25, 2013. Website: http://perl.overmeer.net. The code is based on POSIX, which is released with Perl itself. See also POSIX::Util for additional functionality.

COPYRIGHTS ^

Copyrights 2011-2013 on the perl code and the related documentation by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html

syntax highlighting: