Dev(3pm)

๐Ÿ“ฆ
version 2.085 ยท 4 versions
, in ubuntu noble

๐Ÿ’– Dev(3pm) โ€” the manual page, but make it make sense ๐Ÿ’–

okay so bestie, welcome to Dev(3pm) from the User Contributed Perl Documentation collection ๐ŸŽ€. Yes, the section is 3pm, yes it's a Perl module page, and yes we're about to read the whole thing together. grab a boba, we're doing this ๐Ÿง‹โœจ


๐ŸŒธ NAME ๐ŸŒธ

PDL::Core::Dev โ€” PDL development module. that's it, that's the name, she's lowkey mysterious but we love her ๐Ÿ’…


โœจ DESCRIPTION โœจ

so like. this module is basically a lil treasure chest ๐ŸŽ. it encapsulates most of the stuff useful for PDL development, and it gets used a LOT from inside Makefile.PL's. like, constantly. it's giving backstage-pass energy โ€” you don't see it on stage but the whole show falls apart without it ๐Ÿซถ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

the moment you've been waiting for:

use PDL::Core::Dev;

that's it. that's the whole synopsis. iconic behavior honestly ๐Ÿ‘‘


๐Ÿ’œ FUNCTIONS ๐Ÿ’œ

isbigendian ๐Ÿ”„

bestie. is the machine big or little endian? this function will tell you. no cap.

print "Your machins is big endian.\n" if isbigendian();

(it says "machins" in the original and honestly? we're keeping it. it's part of the lore now ๐Ÿ˜ญ)

  • returns 1 if the machine is big endian
  • returns 0 if little endian
  • dies if neither ๐Ÿ’€

and how does she know?? she peeks at the "byteorder" element of perl's %Config array. detective work fr fr ๐Ÿ”

my $retval = isbigendian();

okay this one is basically a perl configure clone. a whole little baby autoconf situation going on. slay.

if (trylink 'libGL', '', 'char glBegin(); glBegin();', '-lGL') {
  $libs = '-lGLU -lGL';
  $have_GL = 1;
} else {
  $have_GL = 0;
}
$maybe =
  trylink 'libwhatever', $inc, $body, $libs, $cflags,
      {MakeMaker=>1, Hide=>0, Clean=>1};

what she does: tries to link some C-code making up the body of a function, with a given set of library specifiers. like a vibe check but for linking ๐Ÿ”ฅ

returns 1 if successful, 0 otherwise.

trylink $infomsg, $include, $progbody, $libs [,$cflags,{OPTIONS}];

takes 4 + 2 optional arguments. let's go through them one by one, no skips, we're thorough in this house ๐Ÿ’…

  • an informational message to print (can be empty)
  • any commands to be included at the top of the generated C program (typically something like "#include "mylib.h"")
  • the body of the program (in function main)
  • library flags to use for linking. preprocessing by MakeMaker should be performed as needed (see options and example).
  • compilation flags. for example, something like "-I/usr/local/lib". optional argument. empty if omitted.
  • OPTIONS:

OPTIONS โ€” the lil config menu ๐ŸŽ€

  • MakeMaker โ€” preprocess library strings in the way MakeMaker does things. this is advisable to ensure that your code will actually work after the link specs have been processed by MakeMaker. fr, don't skip this one.
  • Hide โ€” controls if linking output etc is hidden from the user or not. on by default except within the build of the PDL distribution, where the config value set in perldl.conf prevails. she's on unless the conf says otherwise ๐Ÿ’ซ
  • Clean โ€” remove temporary files. enabled by default. you might want to switch it off during debugging ๐Ÿ‘€ (yes bestie, that means the temp files stay around so you can stare at them. debugging arc.)

generate_core_flags ๐Ÿ—๏ธ

prints on "STDOUT" XS text with core flags, for Core.xs.

that's the whole thing. she prints. she's straightforward. we respect a no-nonsense queen ๐Ÿ‘‘


got_complex_version ๐Ÿงฎ

PDL::Core::Dev::got_complex_version($func_name, $num_params)

so for a given function appearing in C99's "complex.h", this will return a boolean of whether the system being compiled on has the complex version of that.

like, e.g. for "sin", will test whether csinl exists (before 2.069, would only check for csin, causing build failures on non-C99 compliant libc which mandates long-double versions).

๐Ÿซ  yes bestie this is the "why is my build failing on that one weird libc" function. she exists because things broke. she's a survivor.

๐ŸŒˆ and that's the whole page ๐ŸŒˆ

thanks for coming to my ted talk, you now know PDL::Core::Dev better than like 90% of the people who've ever run a Makefile.PL. periodt ๐Ÿ’…


this lil beauty lives in perl v5.38.2, dated 2024-04-10, and yes it's the Dev(3pm) page, so if you see it in the wild you'll know exactly what's up ๐Ÿซถโœจ mwah, go build something cute ๐ŸŽ€

๐Ÿ“ฆ where this page comes from