1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
|
This is pmtools -- a suite of small programs to help manage modules.
The names are totally preliminary, and in fact, so is the code. We follow
the "keep it small" notion of many tiny tools each doing one thing well,
eschewing giant megatools with millions of options.
Tom Christiansen
tchrist@perl.com
=========================================================
pmpath - show the module's full path
$ pmpath Carp
/usr/local/devperl/lib/5.00554/Carp.pm
=========================================================
pmvers - get a module version number
$ pmvers CGI
2.46
$ perl5.00404 -S pmvers CGI
2.42
$ devperl -S pmvers CGI
2.46
=========================================================
pmdesc - get a module description
$ pmdesc IO::Dir
IO::Dir (1.03) - supply object methods for directory handles
=========================================================
pmall - get all installed modules pmdesc descriptions
$ pmall
Pod::Html (1.01) - module to convert pod files to HTML
Config - access Perl configuration information
DB_File (1.61) - Perl5 access to Berkeley DB
DynaLoader (1.03) - Dynamically load C libraries into Perl code
Fcntl (1.03) - load the C Fcntl.h defines
File::Basename (2.6) - split a pathname into pieces
(etc)
This one is a bit crufty. It takes some options.
Check out the source.
=========================================================
pmdirs - print the perl module path, newline separated
$ pmdirs
/home/tchrist/perllib/i686-linux
/home/tchrist/perllib
/usr/local/devperl/lib/5.00554/i686-linux
/usr/local/devperl/lib/5.00554
/usr/local/devperl/lib/site_perl/5.00554/i686-linux
/usr/local/devperl/lib/site_perl/5.00554
.
$ filsperl -S pmdirs
/home/tchrist/perllib
/usr/local/filsperl/lib/5.00554/i686-linux-thread
/usr/local/filsperl/lib/5.00554
/usr/local/filsperl/lib/site_perl/5.00554/i686-linux-thread
/usr/local/filsperl/lib/site_perl/5.00554
.
=========================================================
plxload - show what files a given program loads at compile time
$ plxload perldoc
/usr/local/devperl/lib/5.00554/Exporter.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/Config.pm
/usr/local/devperl/lib/5.00554/Getopt/Std.pm
$ plxload /usr/src/perl5.005_54/installhtml
/usr/local/devperl/lib/5.00554/Carp.pm
/usr/local/devperl/lib/5.00554/Exporter.pm
/usr/local/devperl/lib/5.00554/auto/Getopt/Long/autosplit.ix
/usr/local/devperl/lib/5.00554/strict.pm
/usr/local/devperl/lib/5.00554/vars.pm
/usr/local/devperl/lib/5.00554/Pod/Functions.pm
/usr/local/devperl/lib/5.00554/Getopt/Long.pm
/usr/local/devperl/lib/5.00554/i686-linux/Config.pm
/usr/local/devperl/lib/5.00554/lib.pm
/home/tchrist/perllib/Pod/Html.pm
/usr/local/devperl/lib/5.00554/Cwd.pm
/usr/local/devperl/lib/5.00554/AutoLoader.pm
=========================================================
pmload - show what files a given module loads at compile 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::File` | wc -l
3131
$ 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
=========================================================
pmexp - show a module's exports
$ pmexp Text::ParseWords
Text::ParseWords automatically exports shellwords, quotewords, nested_quotewords, and parse_line
Text::ParseWords optionally exports old_shellwords
$ pmexp Text::Wrap
Text::Wrap automatically exports wrap and fill
Text::Wrap optionally exports $columns, $break, and $huge
$ pmexp Fcntl
Fcntl automatically exports FD_CLOEXEC, F_DUPFD, F_EXLCK, F_GETFD, F_GETFL, F_GETLK, F_GETLK64, F_GETOWN, F_POSIX, F_RDLCK, F_SETFD, F_SETFL, F_SETLK, F_SETLK64, F_SETLKW, F_SETLKW64, F_SETOWN, F_SHLCK, F_UNLCK, F_WRLCK, O_ACCMODE, O_APPEND, O_ASYNC, O_BINARY, O_CREAT, O_DEFER, O_DSYNC, O_EXCL, O_EXLOCK, O_LARGEFILE, O_NDELAY, O_NOCTTY, O_NONBLOCK, O_RDONLY, O_RDWR, O_RSYNC, O_SHLOCK, O_SYNC, O_TEXT, O_TRUNC, and O_WRONLY
Fcntl optionally exports FAPPEND, FASYNC, FCREAT, FDEFER, FEXCL, FNDELAY, FNONBLOCK, FSYNC, FTRUNC, LOCK_EX, LOCK_NB, LOCK_SH, and LOCK_UN
Fcntl export tag `Fcompat' includes FAPPEND, FASYNC, FCREAT, FDEFER, FEXCL, FNDELAY, FNONBLOCK, FSYNC, and FTRUNC
Fcntl export tag `flock' includes LOCK_SH, LOCK_EX, LOCK_NB, and LOCK_UN
=========================================================
pminst - find what's installed
$ pminst
(lists all installed modules)
$ pminst Carp
CGI::Carp
Carp
$ pminst ^IO::
IO::Socket::INET
IO::Socket::UNIX
IO::Select
IO::Socket
IO::Poll
IO::Handle
IO::Pipe
IO::Seekable
IO::Dir
IO::File
$ pminst '(?i)io'
IO::Socket::INET
IO::Socket::UNIX
IO::Select
IO::Socket
IO::Poll
IO::Handle
IO::Pipe
IO::Seekable
IO::Dir
IO::File
IO
Pod::Functions
The -s flag provides output with the directory separated
by a space:
$ pminst -s | sort +1
(lists all modules, sorted by name, but with where they
came from)
$ perl5.00404 -S pminst -s IO
/usr/lib/perl5/i386-linux/5.00404 IO::File
/usr/lib/perl5/i386-linux/5.00404 IO::Handle
/usr/lib/perl5/i386-linux/5.00404 IO::Pipe
/usr/lib/perl5/i386-linux/5.00404 IO::Seekable
/usr/lib/perl5/i386-linux/5.00404 IO::Select
/usr/lib/perl5/i386-linux/5.00404 IO::Socket
/usr/lib/perl5/i386-linux/5.00404 IO
/usr/lib/perl5/site_perl LWP::IO
/usr/lib/perl5/site_perl LWP::TkIO
/usr/lib/perl5/site_perl Tk::HTML::IO
/usr/lib/perl5/site_perl Tk::IO
/usr/lib/perl5/site_perl IO::Stringy
/usr/lib/perl5/site_perl IO::Wrap
/usr/lib/perl5/site_perl IO::ScalarArray
/usr/lib/perl5/site_perl IO::Scalar
/usr/lib/perl5/site_perl IO::Lines
/usr/lib/perl5/site_perl IO::WrapTie
/usr/lib/perl5/site_perl IO::AtomicFile
The -l flag gives full paths:
$ filsperl -S pminst -l Thread
/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Queue.pm
/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Semaphore.pm
/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Signal.pm
/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Specific.pm
/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread.pm
=========================================================
pmeth - list a class's methods, recursively
$ 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
You might want to send that through grep or grep -v looking
for "via" or "overridden".
=========================================================
pmls - long list the module path
$ pmls CGI
-r--r--r-- 1 root root 190901 Dec 6 03:19
/usr/local/devperl/lib/5.00554/CGI.pm
This is mostly here for people too lazy to type
$ ls -l `pmpath CGI`
=========================================================
pmcat - cat the module source through your pager
$ pmcat CGI
This is mostly here for people too lazy to type
$ more `pmpath CGI`
=========================================================
pman - show the module's pod docs
$ pman CGI
$ pman Curses
This is mostly here for people too lazy to type
$ pod2text `pmpath CGI` | more
=========================================================
pmfunc - show a function source code from a module
$ pmfunc Cwd::getcwd
sub getcwd
{
abs_path('.');
}
This is mostly here for people who are too lazy to type
sed '/^sub getcwd/,/}/p' `pmpath Cwd`
or
perl -ne 'print if /^sub\s+getcwd\b/ .. /}/' `pmpath Cwd`
=========================================================
podgrep - grep in pods of a file
Flags:
-i means case insensitive match
-p means page output
-f means format output
-h means check for matches in pod =head and =item headers alone,
and to keep printing podagraphs until the next header is found.
$ podgrep mail `pmpath CGI`
(prints out podagraphs from the CGI.pm manpage that mention mail)
$ podgrep -i destructor `sitepods`
(prints out podagraphs that mention destructors in the
site-installed pods)
$ podgrep -i 'type.?glob' `stdpods`
(prints out podagraphs that mention typeglob in the
standard pods)
$ podgrep -hpfi "lock" `faqpods`
(prints out all podagraphs with "lock" in the headers
case-insensitively, then then formats these with pod2text, then
shows them in the pager with matches high-lighted)
$ podgrep -fh seek `podpath perlfunc`
(prints out and formats podagraphs from the standard perlfunc manpage
whose headers or items contain "seek".)
=========================================================
pfcat - show pods from perlfunc
(uses podgrep, uses those options)
$ pfcat seek
is like
$ podgrep -h seek `podpath perlfunc`
Whereas
$ pfcat -pf seek
is like
$ podgrep -pfh seek `podpath perlfunc`
which is like
$ podgrep -h seek `podpath perlfunc` | podtext | $PAGER +/seek
=========================================================
podtoc - list table of contents of a podpage
$ podtoc `pmpath CGI`
NAME
SYNOPSIS
ABSTRACT
DESCRIPTION
PROGRAMMING STYLE
CALLING CGI.PM ROUTINES
* 1. Use another name for the argument, if one is available. For
example, -value is an alias for -values.
* 2. Change the capitalization, e.g. -Values
(etc)
=========================================================
podpath - show full path of pod file
(like pmpath, but works on standard manpages, too)
$ podpath Cwd
/usr/local/devperl/lib/5.00554/Cwd.pm
$ devperl -S podpath perlfunc
/usr/local/devperl/lib/5.00554/pod/perlfunc.pod
$ oldperl -S podpath IO::Handle
/usr/lib/perl5/i386-linux/5.00404/IO/Handle.pm
$ filsperl -S podpath Thread
/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread.pm
=========================================================
pods - list all standard pods and module pods
$ pods
=========================================================
sitepods - list only pods in site_perl directories
$ sitepods
/usr/local/devperl/lib/site_perl/5.00554/i686-linux/XML/Parser/Expat.pm
/usr/local/devperl/lib/site_perl/5.00554/i686-linux/XML/Parser.pm
=========================================================
basepods - list only normal "man-page" style pods
$ basepods | grep delt
/usr/local/devperl/lib/5.00554/pod/perl5004delta.pod
/usr/local/devperl/lib/5.00554/pod/perl5005delta.pod
/usr/local/devperl/lib/5.00554/pod/perldelta.pod
=========================================================
faqpods - list only faq pods
=========================================================
modpods - all module pods, including site_perl ones
=========================================================
stdpods - list standard pods, not site_perl ones
|