PMFUNC(1p)
π
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
- ubuntu noble: pmtools 2.2.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: pmtools 2.2.0-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms