in reply to Re^4: Beware of POSIX constants (sorta)
in thread Beware of POSIX constants

Currently, POSIX doesn't require you to import anything - and I think your solution does. Furthermore, your solution fixes the problem of the missing prototype at the cost of why POSIX's constants don't have prototypes: in order to reduce the overhead of 'use POSIX', functions are autoloaded - you don't pay compile costs for functions you don't need. Your solution does a string eval for each all caps function. Then you might as well have listed all of them in POSIX.pm.
Perl --((8:>*
  • Comment on Re^5: Beware of POSIX constants (sorta)

Replies are listed 'Best First'.
Re^6: Beware of POSIX constants (sorta)
by tye (Sage) on Oct 04, 2005 at 14:32 UTC
    [...] your solution [...]

    ...was a "quick demonstration". Your solutions... oh... you don't have a solution. Just trying to prop up your claim that autoloading is the source of the problem? (:

    Note also that you can have POSIX export real constants but have the autoloaded ones in POSIX:: not require predeclaration. That would mean that the only "performance hit" is for people who do "use POSIX;", who are already getting a "performance hit" for importing hundreds of symbols. But even predeclaring all several hundred POSIX constants as actually being constants takes a fraction of a 1/100th of a second on my lowly PC, so I don't see this as a big problem that needs to be avoided.

    - tye