| 1 |
#!/usr/bin/env perl |
| 2 |
# pfcat - cat out function definitions from perlfunc |
| 3 |
# |
| 4 |
# this is a command of its own so it can find the right version |
| 5 |
|
| 6 |
# ------ pragmas |
| 7 |
use strict; |
| 8 |
use warnings; |
| 9 |
|
| 10 |
our $VERSION = '2.0.0'; |
| 11 |
|
| 12 |
# ------ define variable |
| 13 |
my @options = (); # list of podgrep options |
| 14 |
|
| 15 |
@options = (); |
| 16 |
while ($ARGV[0] =~ /^-/) { |
| 17 |
push @options, shift @ARGV; |
| 18 |
} |
| 19 |
|
| 20 |
die "usage: $0 function\n" unless @ARGV; |
| 21 |
|
| 22 |
system "$^X -S podgrep -h @options '@ARGV' `$^X -S podpath perlfunc`"; |
| 23 |
exit ($? != 0); |
| 24 |
|
| 25 |
__END__ |
| 26 |
|
| 27 |
=head1 NAME |
| 28 |
|
| 29 |
pfcat - grep out function definitions from perlfunc |
| 30 |
|
| 31 |
=head1 DESCRIPTION |
| 32 |
|
| 33 |
This program uses I<podgrep> program to search your configuration's |
| 34 |
L<perlfunc> for function definitions. It honors a B<-f> flag to |
| 35 |
format through I<pod2text> and a B<-p> flag to send the output |
| 36 |
through the pager. (Actually, it just passes these to I<podgrep>.) |
| 37 |
|
| 38 |
=head1 EXAMPLES |
| 39 |
|
| 40 |
$ pfcat seek |
| 41 |
(find all seek functions (including sysseek)) |
| 42 |
|
| 43 |
$ pfcat -pf sprintf |
| •44 |
(sprintf function is formatted and sent to pager) |
| 45 |
|
| 46 |
$ pfcat -f '\bint\b' |
| 47 |
/usr/local/devperl/lib/5.00554/pod/perlfunc.pod chunk 506 |
| 48 |
int EXPR |
| 49 |
int |
| 50 |
|
| 51 |
Returns the integer portion of EXPR. If EXPR is omitted, uses |
| 52 |
`$_'. You should not use this for rounding, because it truncates |
| 53 |
towards `0', and because machine representations of floating point |
| 54 |
numbers can sometimes produce counterintuitive results. Usually |
| 55 |
`sprintf()' or `printf()', or the `POSIX::floor' or `POSIX::ceil' |
| 56 |
functions, would serve you better. |
| 57 |
|
| 58 |
You can also run this using alternate perl binaries, like so: |
| 59 |
|
| 60 |
$ oldperl -S pfcat open |
| 61 |
.... |
| 62 |
|
| 63 |
=head1 SEE ALSO |
| 64 |
|
| 65 |
podgrep(1) |
| 66 |
|
| 67 |
=head1 AUTHORS and COPYRIGHTS |
| 68 |
|
| 69 |
Copyright (C) 1999 Tom Christiansen. |
| 70 |
|
| 71 |
Copyright (C) 2006-2014 Mark Leighton Fisher. |
| 72 |
|
| 73 |
=head1 LICENSE |
| 74 |
|
| 75 |
This is free software; you can redistribute it and/or modify it |
| 76 |
under the terms of either: |
| 77 |
(a) the GNU General Public License as published by the Free |
| 78 |
Software Foundation; either version 1, or (at your option) any |
| 79 |
later version, or |
| 80 |
(b) the Perl "Artistic License". |
| 81 |
(This is the Perl 5 licensing scheme.) |
| 82 |
|
| 83 |
Please note this is a change from the |
| 84 |
original pmtools-1.00 (still available on CPAN), |
| 85 |
as pmtools-1.00 were licensed only under the |
| 86 |
Perl "Artistic License". |