develooper Front page | perl.perl5.porters | Postings from April 2003

[PATCH ext/POSIX/POSIX.pod] Deceptive POSIX exporting docs

Thread Next
From:
Michael G Schwern
Date:
April 30, 2003 21:29
Subject:
[PATCH ext/POSIX/POSIX.pod] Deceptive POSIX exporting docs
Message ID:
20030501011932.GM701@windhund.schwern.org
POSIX exports nearly everything.  There's only a small handful of
functions it doesn't.  This is unfortunate, but unfixable.

The docs read:

  The POSIX module permits you to access all (or nearly all) the standard
  POSIX 1003.1 identifiers.  Many of these identifiers have been given Perl-ish
  interfaces.  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.

"Things which are C<#defines> in C, like ENTIR or O_NDELAY, are automatically
exported into our namespace" implies that only constants and no functions
are exported.  In fact, lots of functions are exported.

"All functions are only exported if you ask for them explicitly" seems
to directly contradict the fact that lots of functions are exported by
default.  isalnum, isalpha, creat, setllocale, acos, asin, longjmp,
sigpending, offsetof, fclose, etc... just to name a few.

This is all very misleading.  I think the proper way to describe the 
line between what is exported by default and what isn't is to say:

  I<Everything is exported by default> with the exception of any POSIX functions
  with the same name as a built-in Perl function such as C<abs>, C<alarm>,
  C<rmdir>, C<write>, etc.  This is an unfortunate backwards compatiblity
  feature.  You can stop the exporting by saying C<use POSIX ()> and then
  use the fully qualified names (ie. POSIX::SEEK_END).

This makes it very clear that POSIX is going to export a whole lot of
crap.

--- ext/POSIX/POSIX.pod	2003/05/01 01:15:49	1.1
+++ ext/POSIX/POSIX.pod	2003/05/01 01:17:31
@@ -19,10 +19,14 @@
 
 The POSIX module permits you to access all (or nearly all) the standard
 POSIX 1003.1 identifiers.  Many of these identifiers have been given Perl-ish
-interfaces.  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.
+interfaces.
+
+I<Everything is exported by default> with the exception of any POSIX
+functions with the same name as a built-in Perl function, such as
+C<abs>, C<alarm>, C<rmdir>, C<write>, etc.., which will be exported
+only if you ask for them explicitly.  This is an unfortunate backwards
+compatiblity feature.  You can stop the exporting by saying C<use
+POSIX ()> and then use the fully qualified names (ie. C<POSIX::SEEK_END>).
 
 This document gives a condensed list of the features available in the POSIX
 module.  Consult your operating system's manpages for general information on


-- 
HA HA HA  You're all so rediculous!  But thanks for the money!

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About