PMETH(1p)

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

πŸ’– PMETH πŸ’–

ok so bestie, this is pmeth β€” a little Perl script (section 1p of the manual, aka User Contributed Perl Documentation, and yes that's the vibe) that shows you a Perl class's methods. literally that's it. that's the whole thing. she's simple, she's useful, she ate.


✨ NAME ✨

pmeth β€” show a Perl class's methods 🫢


🌸 DESCRIPTION 🌸

okay so you give her a class name and she prints out every method that class has access to. how?? she loads in the class module and then goes for a lil walk through its symbol table, plus the symbol tables of all its ancestor classes. she's thorough like that πŸ’…

a regular, home-grown method call just shows up plain and simple:

$ pmeth IO::Socket | grep '^con'
confess
configure
connect
connected

but a method that came from somewhere else? she flags it with one or more "via" notations so you know exactly where it's from:

DESTROY via IO::Handle
export via Exporter via IO::Handle

and if a base-class method is unavailable because a closer derived-class method with the same name is hiding it β€” but you could still get to it via SUPER:: β€” she slaps a leading [overridden] on it before the name:

[overridden] new via IO::Handle

constants declared via constant get a leading [constant] added to the output. but XS define's are not yet so flagged (as in, not yet, bestie, we're aware 😭).


πŸŽ€ EXAMPLES πŸŽ€

here's the whole thing in action, no edits, no cap:

$ pmeth IO::Socket
AF_INET
AF_UNIX
INADDR_ANY
INADDR_BROADCAST
INADDR_LOOPBACK
INADDR_NONE
SOCK_DGRAM
SOCK_RAW
SOCK_STREAM
accept
bind
carp
confess
configure
connect
connected
croak
getsockopt
import
inet_aton
inet_ntoa
listen
new
pack_sockaddr_in
pack_sockaddr_un
peername
protocol
recv
register_domain
send
setsockopt
shutdown
sockaddr_in
sockaddr_un
sockdomain
socket
socketpair
sockname
sockopt
socktype
timeout
unpack_sockaddr_in
unpack_sockaddr_un
DESTROY via IO::Handle
SEEK_CUR via IO::Handle
SEEK_END via IO::Handle
SEEK_SET via IO::Handle
_IOFBF via IO::Handle
_IOLBF via IO::Handle
_IONBF via IO::Handle
_open_mode_string via IO::Handle
autoflush via IO::Handle
blocking via IO::Handle
[overridden] carp via IO::Handle
clearerr via IO::Handle
close via IO::Handle
[overridden] confess via IO::Handle
constant via IO::Handle
[overridden] croak via IO::Handle
eof via IO::Handle
error via IO::Handle
fcntl via IO::Handle
fdopen via IO::Handle
fileno via IO::Handle
flush via IO::Handle
format_formfeed via IO::Handle
format_line_break_characters via IO::Handle
format_lines_left via IO::Handle
format_lines_per_page via IO::Handle
format_name via IO::Handle
format_page_number via IO::Handle
format_top_name via IO::Handle
format_write via IO::Handle
formline via IO::Handle
gensym via IO::Handle
getc via IO::Handle
getline via IO::Handle
getlines via IO::Handle
gets via IO::Handle
input_line_number via IO::Handle
input_record_separator via IO::Handle
ioctl via IO::Handle
[overridden] new via IO::Handle
new_from_fd via IO::Handle
opened via IO::Handle
output_field_separator via IO::Handle
output_record_separator via IO::Handle
print via IO::Handle
printf via IO::Handle
printflush via IO::Handle
qualify via IO::Handle
qualify_to_ref via IO::Handle
read via IO::Handle
setbuf via IO::Handle
setvbuf via IO::Handle
stat via IO::Handle
sync via IO::Handle
sysread via IO::Handle
syswrite via IO::Handle
truncate via IO::Handle
ungensym via IO::Handle
ungetc via IO::Handle
untaint via IO::Handle
write via IO::Handle
_push_tags via Exporter via IO::Handle
export via Exporter via IO::Handle
export_fail via Exporter via IO::Handle
export_ok_tags via Exporter via IO::Handle
export_tags via Exporter via IO::Handle
export_to_level via Exporter via IO::Handle
[overridden] import via Exporter via IO::Handle
require_version via Exporter via IO::Handle
VERSION via UNIVERSAL
can via UNIVERSAL
[overridden] import via UNIVERSAL
isa via UNIVERSAL

like. look at all that. the via chains stacking up (via Exporter via IO::Handle?? she's giving lineage πŸ¦‹) and the [overridden] ones sitting there all humble. iconic.


πŸ’€ NOTE πŸ’€

ok this is the important one, listen up.

Perl makes no distinction between functions, procedures, and methods. none. zero. also no distinction between public or nominally private, and no distinction between whether a method is nominally a class method, an object method, or both. they all show up as subs in the package namespace. periodt.

so if your class says use Carp, congratulations bestie, you just polluted your namespace with things like croak() and confess(), which will now appear to be available as method calls on objects of your class. πŸ™ˆ they're not really yours. they just live there now. vibe check: failed.


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS and COPYRIGHTS πŸ‘‘

Copyright (C) 1999 Tom Christiansen.

Copyright (C) 2006-2014 Mark Leighton Fisher.


🧚 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".

ok so that last bit is a real heads-up, not a vibe: the licensing genuinely changed from pmtools-1.00, which was Artistic License only. now it's dual. slay for freedom of choice honestly πŸ’…

and that's the whole page, bestie 🫢 this was perl v5.36.0, dated 2022-10-14, and yeah she's still out here being PMETH(1p). go check your classes. go find your [overridden]s. ily, bye ✨

πŸ“¦ where this page comes from