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 perlCurrently, 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.
IVSigned integer. At least 32 bits.
UVUnsigned integer. The same size as
IV.NVFloating-point type. Probably
double. Possiblylong double.PV NUL[L]Terminated string. Length will be determined with
strlen.PVNA 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.SVA mortal SV.
YESTruth (
PL_sv_yes). The value is not needed (and is ignored).NODefined falsehood (
PL_sv_no). The value is not needed (and is ignored).UNDEFThe value of the macro is not needed.
ExtUtils::Constant implements the following functions.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access