CLI-Framework
view release on metacpan or search on metacpan
t/lib/My/PerlFunctions/Command/Summary.pm view on Meta::CPAN
package My::PerlFunctions::Command::Summary;
use base qw( CLI::Framework::Command );
use strict;
use warnings;
sub option_spec {
[ 'name=s' => 'name of perl function' ],
}
sub validate {
my ($self, $opts, @args) = @_;
die "name option required", $self->usage(), "\n" unless exists $opts->{name};
}
sub run {
my ($self, $opts, @args) = @_;
print "[finding function...]\n" if $self->cache->get('verbose');
while(<DATA>) {
my ($name) = (m/(.*?)\s+\- /);
next unless $name;
if( $name eq $opts->{name} ) {
seek DATA, 0, 0;
return $_;
}
}
return "function '".$opts->{name}."' not found";
}
sub usage_text {
q{
summary --name=<function-name>: print a one-line summary of the the named perl function
}
}
#-------
1;
=pod
=head1 PURPOSE
The Command class for a very simple CLIF app demo.
=cut
__DATA__
abs - absolute value function
accept - accept an incoming socket connect
alarm - schedule a SIGALRM
atan2 - arctangent of Y/X in the range -PI to PI
bind - binds an address to a socket
binmode - prepare binary files for I/O
bless - create an object
break - exit a loop prematurely
caller - get context of the current subroutine call
chdir - change your current working directory
chmod - changes the permissions on a list of files
chomp - remove a trailing record separator from a string
chop - remove the last character from a string
chown - change the owership on a list of files
chr - get character this number represents
chroot - make directory new root for path lookups
close - close file (or pipe or socket) handle
closedir - close directory handle
connect - connect to a remote socket
continue - optional trailing block in a while or foreach
cos - cosine function
crypt - one-way passwd-style encryption
dbmclose - breaks binding on a tied dbm file
dbmopen - create binding on a tied dbm file
defined - test whether a value, variable, or function is defined
delete - deletes a value from a hash
die - raise an exception or bail out
do - turn a BLOCK into a TERM
dump - create an immediate core dump
each - retrieve the next key/value pair from a hash
endgrent - be done using group file
endhostent - be done using hosts file
endnetent - be done using networks file
endprotoent - be done using protocols file
endpwent - be done using passwd file
endservent - be done using services file
eof - test a filehandle for its end
eval - catch exceptions or compile and run code
exec - abandon this program to run another
exists - test whether a hash key is present
exit - terminate this program
exp - raise I to a power
fcntl - file control system call
fileno - return file descriptor from filehandle
flock - lock an entire file with an advisory lock
fork - create a new process just like this one
format - declare a picture format with use by the write() function
formline - internal function used for formats
getc - get the next character from the filehandle
getgrent - get next group record
getgrgid - get group record given group user ID
getgrnam - get group record given group name
gethostbyaddr - get host record given its address
gethostbyname - get host record given name
gethostent - get next hosts record
getlogin - return who logged in at this tty
getnetbyaddr - get network record given its address
getnetbyname - get networks record given name
getnetent - get next networks record
getpeername - find the other end of a socket connection
getpgrp - get process group
getppid - get parent process ID
getpriority - get current nice value
getprotobyname - get protocol record given name
getprotobynumber - get protocol record numeric protocol
getprotoent - get next protocols record
getpwent - get next passwd record
getpwnam - get passwd record given user login name
getpwuid - get passwd record given user ID
getservbyname - get services record given its name
getservbyport - get services record given numeric port
( run in 1.342 second using v1.01-cache-2.11-cpan-99c4e6809bf )