The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/env perl
# pfcat - cat out function definitions from perlfunc 
# tchrist@perl.com
# 
# this is a command of its own so it can find the right version


@options = ();
while ($ARGV[0] =~ /^-/) {
    push @options, shift @ARGV;
} 

die "usage: $0 function\n" unless @ARGV;

system "$^X -S podgrep -h @options '@ARGV' `$^X -S podpath perlfunc`";
exit ($? != 0);

__END__

=head1 NAME

pfgrep - grep out function definitions from perlfunc 

=head1 DESCRIPTION

This program uses I<podgrep> program to search your configuration's
L<perlfunc> for function definitions.  It honors a B<-f> flag to 
format through I<pod2text> and a B<-p> flag to send the output
through the pager.  (Actually, it just passes these to I<podgrep>.)

=head1 EXAMPLES

    $ pfcat seek
    (find all seek functions (including sysseek))

    $ pfcat -pf sprintf
    (sprintf function is formated and sent to pager)

    $ pfcat -f '\bint\b'
    /usr/local/devperl/lib/5.00554/pod/perlfunc.pod chunk 506
    int EXPR
    int

    Returns the integer portion of EXPR. If EXPR is omitted, uses
    `$_'. You should not use this for rounding, because it truncates
    towards `0', and because machine representations of floating point
    numbers can sometimes produce counterintuitive results. Usually
    `sprintf()' or `printf()', or the `POSIX::floor' or `POSIX::ceil'
    functions, would serve you better.

You can also run this using alternate perl binaries, like so:

    $ oldperl -S pfcat open
    ....

=head1 SEE ALSO

podgrep(1)

=head1 AUTHOR and COPYRIGHT

Copyright (c) 1999 Tom Christiansen

This is free software.  You may modify it and distribute it 
under Perl's Artistic Licence.  Modified versions must be
clearly indicated.