ExtUtils::Constant
Generates XS code to import C header constants, allowing Perl modules to AUTOLOAD constants defined in C library header files. Generally, you should not touch ExtUtils::Constant functions, since they are already implemented by h2xs.
For example:
use ExtUtils::Constant qw (WriteConstants); WriteConstants( NAME => `Nate', NAMES => [qw(Nate Nathan Nathaniel)], # not Nat ); # Generates wrapper code to make the values of the constants # Nate Nathan Nathaniel available to perl
Currently, this module understands the following types, although h2xs may only know a subset. The sizes of the numeric types are chosen by the Configure script at compile time.
IV
Signed integer. At least 32 bits.
UV
Unsigned integer. The same size as
IV
.NV
Floating-point type. Probably
double
. Possiblylong double
.PV NUL[L]
Terminated string. Length will be determined with
strlen
.PVN
A fixed-length thing, given as a pointer, length pair. If you know the length of a string at compile time, you can use this instead of
PV
.SV
A mortal SV.
YES
Truth (
PL_sv_yes
). The value is not needed (and is ignored).NO
Defined falsehood (
PL_sv_no
). The value is not needed (and is ignored).UNDEF
The value of the macro is not needed.
ExtUtils::Constant implements the following functions.
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.