PMFUNC(1p)

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

πŸ’… PMFUNC β€” okay bestie, let's talk about pmfunc

So like, the whole entire point of pmfunc is: cat out a function from a module. That's the vibe. That's the name. Periodt. ✨


🌸 DESCRIPTION 🌸

You hand it a fully-qualified function β€” like, module and function, no half-measures β€” and this little icon opens up the file and attempts to display the source for that function. That's it. That's the whole job. And honestly? It ate. πŸ”₯


πŸŽ€ EXAMPLES πŸŽ€

Here's the moment you've been waiting for, bestie:

$ pmfunc Cwd::_perl_getcwd
sub _perl_getcwd
{
    abs_path('.');
}

Not me getting the actual source printed straight to my terminal like a main character. Obsessed. πŸ’–


πŸ¦‹ RESTRICTIONS πŸ¦‹

Okay so real talk, there's a catch, and we're gonna be honest about it: only subroutines that are defined in the normal fashion are seen, because the extraction is literally just a simple pattern-match. It's giving "girl with a regex and a dream." πŸ™ˆ

So anything loaded some other way β€” think via AUTOLOAD, or typeglob aliasing, or sitting inside an "eval" β€” is necessarily gonna be missed. Not a bug, just the limits of the pattern-match life. 😭

Basically this whole thing exists for people who are too lazy to type the long version, which looks like:

sed '/^sub getcwd/,/}/p' `pmpath Cwd`

or

perl -ne 'print if /^sub\s+getcwd\b/ .. /}/' `pmpath Cwd`

Like, yeah. Same energy, way more typing. You're welcome. πŸ’…


🌈 RESTRICTIONS 🌈


⭐ SEE ALSO ⭐


πŸ‘‘ AUTHORS and COPYRIGHTS πŸ‘‘

Copyright (C) 1999 Tom Christiansen.

Copyright (C) 2006-2014, 2018 Mark Leighton Fisher.

Shoutout to the legends, fr fr. 🫢


🧚 LICENSE 🧚

This is free software; you can redistribute it and/or modify it under the terms of either: (a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or (b) the Perl "Artistic License". (This is the Perl 5 licensing scheme.)

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". So like, glow-up but make it legal. πŸ’€

✨ and that's the whole page, bestie ✨ this was documented for perl v5.36.0, dated 2022-10-14, and filed under PMFUNC(1p). slay, go read a function πŸŽ€

πŸ“¦ where this page comes from