=pod =for advent_year 2008 =for advent_day 16 =for advent_title Loads of Christmas cheer =for advent_author Jerrad Pierce =begin eds Apologies for calendar spottiness. Crummy term papers are finally in, and we now return you to your regularly scheduled programming. =end eds DynaLoader makes the use of giant C libraries like the POSIX module a lot less hairy by only loading those functions you use/request, as opposed to only exposing those you request as is the case with a traditional import. That's interesting and all, but XS is so arcane. What about us mortals? After reading P<2008-12|Friday's> entry, I thought to myself that there ought to be some simple way of consolidating the examples into a single script that wouldn't load unnecessary code. At this point I rediscovered M, a pure perl analog to DynaLoader. M provides deferred compilation (and some of the potential pitfalls that entails) of rarely used code and is ideal for large libraries; where, it seems to this author, it is unfortunately underused. This magic is achieved through C and string C, meaning we are also able to defer dependencies with no extra effort if they are Cd where needed e.g; lines 65 & 74. An additional feature—of debatable merit some would argue—when using M to provide for minimal loading and export of a library's functions is that because it uses C, one needn't bother with potentially long and cumbersome import lists. A few other adjustments, and this single script is ready for primetime on both barebones servers and decked-out desktops alike. =begin pre time_t: 1229475664 oct: 11122047520 hex: 49484F50 ascii: 'IHOP' local: Tue Dec 16 20:01:04 2008 zulu: Wed Dec 17 01:01:04 2008 =end pre =sourcedcode mod16.pl