PMLOAD(1p)

πŸ“¦
version 2.2.0 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– PMLOAD ✨

okay bestie, welcome to pmload β€” a lil user-contributed Perl doc situation, manual page PMLOAD(1p), living in the User Contributed Perl Documentation section. she's a one-trick pony and the trick is iconic. let's get into it 🫢


🌸 NAME 🌸

pmload β€” bestie, this shows you what files a given module loads at compile time. literally that's the whole job. no cap. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: you hand pmload an argument that is a module name, and it shows you all the files that get loaded β€” directly or indirectly β€” when that module is used at compile-time. like, the whole friend group of files that came along. the main character plus everybody they dragged in. πŸ‘‘


πŸŽ€ EXAMPLES πŸŽ€

watch her work, she eats every time:

$ pmload IO::Handle
/usr/local/devperl/lib/5.00554/Exporter.pm
/usr/local/devperl/lib/5.00554/Carp.pm
/usr/local/devperl/lib/5.00554/strict.pm
/usr/local/devperl/lib/5.00554/vars.pm
/usr/local/devperl/lib/5.00554/i686-linux/DynaLoader.pm
/usr/local/devperl/lib/5.00554/i686-linux/IO/Handle.pm
/usr/local/devperl/lib/5.00554/Symbol.pm
/usr/local/devperl/lib/5.00554/i686-linux/IO/File.pm
/usr/local/devperl/lib/5.00554/SelectSaver.pm
/usr/local/devperl/lib/5.00554/i686-linux/Fcntl.pm
/usr/local/devperl/lib/5.00554/AutoLoader.pm
/usr/local/devperl/lib/5.00554/i686-linux/IO.pm
/usr/local/devperl/lib/5.00554/i686-linux/IO/Seekable.pm

$ cat `pmload IO::Socket` | wc -l
   4015

$ oldperl -S pmload Tk
/usr/lib/perl5/site_perl/Tk/Pretty.pm
/usr/lib/perl5/Symbol.pm
/usr/lib/perl5/site_perl/Tk/Frame.pm
/usr/lib/perl5/site_perl/Tk/Toplevel.pm
/usr/lib/perl5/strict.pm
/usr/lib/perl5/Exporter.pm
/usr/lib/perl5/vars.pm
/usr/lib/perl5/site_perl/auto/Tk/Wm/autosplit.ix
/usr/lib/perl5/site_perl/auto/Tk/Widget/autosplit.ix
/usr/lib/perl5/site_perl/Tk.pm
/usr/lib/perl5/i386-linux/5.00404/DynaLoader.pm
/usr/lib/perl5/site_perl/auto/Tk/Frame/autosplit.ix
/usr/lib/perl5/site_perl/auto/Tk/Toplevel/autosplit.ix
/usr/lib/perl5/Carp.pm
/usr/lib/perl5/site_perl/auto/Tk/autosplit.ix
/usr/lib/perl5/site_perl/Tk/CmdLine.pm
/usr/lib/perl5/site_perl/Tk/MainWindow.pm
/usr/lib/perl5/site_perl/Tk/Submethods.pm
/usr/lib/perl5/site_perl/Tk/Configure.pm
/usr/lib/perl5/AutoLoader.pm
/usr/lib/perl5/site_perl/Tk/Derived.pm
/usr/lib/perl5/site_perl/Tk/Image.pm
/usr/lib/perl5/site_perl/Tk/Wm.pm
/usr/lib/perl5/site_perl/Tk/Widget.pm

look at that 4015 😭 she's not doing the bare minimum and we respect it fr fr.


πŸ’€ NOTE πŸ’€

okay this is the important tea, don't skip it. β˜•

if the programmers used a delayed require, those files won't show up. periodt. and on top of that β€” this doesn't show all possible files that get opened, just those that show up in %INC. so it's giving "mostly the truth, not the whole truth". πŸ™ˆ

most systems have a way to trace system calls. you can use this to find the real answer.

first, get a baseline with no modules loaded:

$ strace perl -e 1 2>&1 | perl -nle '/^open\("(.*?)".* = [^-]/ && print $1'
/etc/ld.so.cache
/lib/libnsl.so.1
/lib/libdb.so.2
/lib/libdl.so.2
/lib/libm.so.6
/lib/libc.so.6
/lib/libcrypt.so.1
/dev/null

$ strace perl -e 1 2>&1 | grep -c '^open.*= [^-]'
8

now add module loads and see what you get, bestie:

$ strace perl -MIO::Socket -e 1 2>&1 | grep -c '^open.*= [^-]'
24

$ strace perl -MTk -e 1 2>&1 | grep -c '^open.*= [^-]'
35

see the difference? 8 β†’ 24 β†’ 35. the numbers do not lie, and neither does strace. πŸ”₯


🌈 SEE ALSO 🌈

  • Devel::Loaded β€” sibling energy
  • plxload(1) β€” the other one in the family

πŸ‘‘ AUTHORS and COPYRIGHTS πŸ‘‘

  • Copyright (C) 1999 Tom Christiansen.
  • Copyright (C) 2006-2014 Mark Leighton Fisher.

respect to the originators, we love a credited queen. 🫢


🧚 LICENSE 🧚

this is free software; you can redistribute it and/or modify it under the terms of either:

  1. (a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or
  2. (b) the Perl "Artistic License".

(this is the Perl 5 licensing scheme.) ✨

heads up bestie: please note this is a change from the original pmtools-1.00 (still available on CPAN), as pmtools-1.00 were licensed only under the Perl "Artistic License".

and that's the whole page, babes. this one came from perl v5.36.0, dated 2022-10-14, and it's the PMLOAD(1p) manpage β€” go trace some modules, you've got this πŸ’œπŸŒΈ

πŸ“¦ where this page comes from